Loading Igor from a Batch File
andrea.darlington
I'd like to create a windows batch file to do two things:
1) Launch Igor and open a particular experiment file.
2) Run a command in this experiment file.
So far I have this:
"C:\Program Files (x86)\Wavemetrics\Igor Pro Folder\Igor64.exe" "E:\Documents\Igor_Experiments\Experiment.pxp"
"C:\Program Files (x86)\Wavemetrics\Igor Pro Folder\Igor64.exe" /X "runFunction()"
When I run this file it launches Igor and opens the specified experiment but it doesn't run the function. Once I close the experiment file it immediately opens another instance of Igor and tries to run the command but can't because that command does not exist in the blank experiment file. Is there a way to get this to work? I know that I could put the command in the procedure window before any of the functions and it would be run when Igor launches but ideally I'd like to have two batch files for the users of my program to work with: one that would do what I've talked about above and one that would only open the experiment without running the function.
Any ideas are greatly appreciated!
Thank you!
Andrea
An alternative approach would be to put runFunction() at the top of the built-in procedure window, as you mentioned. You could modify your runFunction() code a bit to test whether a key is pressed (eg. the Alt/Option key) and if it is then bail out. Otherwise runFunction() does whatever it normally does.
December 20, 2017 at 06:58 am - Permalink
start /b "" "C:\Program Files\Wavemetrics\Igor Pro 7 Folder\IgorBinaries_x64\Igor64.exe" /X "make test"<br />
ping 127.0.0.1 /n 10 > nul<br />
start /b "" "C:\Program Files\Wavemetrics\Igor Pro 7 Folder\IgorBinaries_x64\Igor64.exe" /X "display test"<br />
The ping command is used to give Igor some time to start up. The number of pings (10) can be adjusted to your needs.
HJ
Note: Maybe this issue with batch files could be added to the manual in section "Calling Igor from Scripts"?
December 20, 2017 at 07:27 am - Permalink
Thank you!
December 20, 2017 at 07:45 am - Permalink
start "C:\Program Files (x86)\Wavemetrics\Igor Pro Folder\Igor64.exe" "E:\Documents\Igor_Experiments\Experiment.pxp" & timeout/t 20 "C:\Program Files (x86)\Wavemetrics\Igor Pro Folder\Igor64.exe" /X "runFunction()"
December 20, 2017 at 02:38 pm - Permalink
sleep
. I wanted to avoid conditional batch files.ping
works on any windows version (>3.1, I think).HJ
December 20, 2017 at 11:59 pm - Permalink