Thanks Roger. Not quite what I am look for. The application shelled out (prop,exe) generates a text file, which xojo has to read in and populate labels, graphs etc.
The process is repeated but we don’t re-shell prog.exe. It stays running in teh back ground picking up input text files and generate output text for populating controls in xojo.
What I don’t understand is why prog.exe does not read data files present on that folder?
So, your shell creates a text file and that text file is what you want to read into your program?
After reading it in it needs to set a label or something else?
is that correct?
There are many files involved and read by prog.exe. One input text file is generated by xojo for prog,exe before shelling. When prog.exe has finished it generates an output text file for xojo to read and has to update xojo forms (labels, graphs etc., although prog,exe is still running in the back ground waiting for a next input text file from xojo).
Inputs are entered by to user via text boxes, sliders, etc. until the use decides to end the application via an end button.
This is an engine simulator and did it all in VB6. I would like to do this in XOJO but prog.exe does not find the files it needs but they are there in that folder?
Ok, so prog.exe gives you an text file and xojo has to read that in.
Well, what you can do is read that file in with xojo.
You don’t need the shell for that.
All you have to know is the full path and the name to that text file.
The code from you quistion, does that work?
If you want only to keep prog.exe on the background, there is an easy way.
see the video.
Thanks for that - I can read and write text files from XOJO. But want to shell out the application prog.exe rather than starting it separately, which I have not tried yet.
When I shell prop.exe it starts reading files but it can’t find them? Why, when I have set the folder where prog.exe and data files reside on the disk it, it can find the data files?
Guessing, I would say that this prog.exe is assuming the default directory to be the one it ran from. That is likely true when you run it manually, but won’t necessarily be true when running it from a shell.
You might instead try FolderItem.Open or determine if there is a way to tell prog.exe more precisely where to look for files.
dim sh as new shell
dim f as FolderItem
dim ss as string
f=new folderitem(“C:\foldername\prog,exe”)
ss=“c: && cd \foldername && prog,exe”
if f <> nil then
if f.Exists then
sh.Execute(ss)
else
messagebox"File not found"
end
end if
However, it keep bring up the folder dialog box. I would have thought that it would return to the main form, as a button action on this form starts the process.
i tried fff = Folderitem.ShowSelectFolderDialog(“full folder name”) it does’nt like that
Window1.PushButton2.Action, line 2
Too many arguments: got 1, expected only 0.
fff = Folderitem.ShowSelectFolderDialog("****\simulator\NPSS_Style-BetaL\GenexB")
If your application is installed in the same folder as prog.exe then that will be the current folder so you won’t need to cd before executing prog.exe.