There is a specific program that I am attempting to launch and automate. When the program opens I need to press a button and then set two different combo boxes to a specific value (they are already pre-populated with choices).
When I launch this program via RunProgram, for some strange reason, the combo boxes are empty with no choices. This also occurs if I use RunProgram to launch CMD.exe and pass the program as a parameter. I also set MS to launch with admin but that did not help either.
It works fine if I launch the program myself through windows explorer or via the command prompt.
What I would like to know is how macro scheduler is executing the launch of external programs. Or maybe someone can shed some light on what may be happening?
If anyone is interested in trying this it is free software (used for programming circuit boards): http://www.freescale.com/files/soft_dev ... LASHER.zip.
RunProgram, Weird Behavior
Moderators: Dorian (MJT support), JRL
Re: RunProgram, Weird Behavior
Sounds like the script can't find its home directory. Try setting the system variable "CWD" (Current Working Directory) to the path where the exe resides prior to the RunProgram line.
For example if the exe is named Lasher and is located in C:\Programs\FreeScale
Try something like
For example if the exe is named Lasher and is located in C:\Programs\FreeScale
Try something like
Code: Select all
Let>CWD=C:\Programs\FreeScale
RunProgram>C:\Programs\FreeScale\Lasher.exe
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: RunProgram, Weird Behavior
To set the current working directory you need to do:
ChangeDirectory>C:\Programs\FreeScale
Setting CWD won't change the working directory. CWD only *reflects* the current working directory.
ChangeDirectory>C:\Programs\FreeScale
Setting CWD won't change the working directory. CWD only *reflects* the current working directory.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Re: RunProgram, Weird Behavior
Thanks for the correction. Hopefully the working directory is the problem so using ChangeDirectory> will resolve the issue.
Re: RunProgram, Weird Behavior
Thank you for the quick support guys. That was it - works perfect now.
To get a better understanding of this I have a few more questions:
To get a better understanding of this I have a few more questions:
- Is it advisable to set the working directory every time before launching a program, or only when issues like this are observed?
- Is the default current directory equivalent to SCRIPT_DIR?
- Is it advisable to set the current directory back to original state after launching the program?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: RunProgram, Weird Behavior
Depends on the application in question. My experience is it is rare that you have to do this but there are some apps which need you to do it. And it's worth noting that Windows shortcuts have a "Start In" directory entry which is usually set to the folder containing the .exe. Some apps want this. Others don't care.Is it advisable to set the working directory every time before launching a program, or only when issues like this are observed?
No, the working directory changes all the time depending on what an app/Windows is doing. When you first start Macro Scheduler it is most likely going to happen to be the main Macro Scheduler data folder, but depends on how you have things set up and what happens. So yeh most likely it is probably SCRIPT_DIR to start with but not necessarily.Is the default current directory equivalent to SCRIPT_DIR?
No, no need.Is it advisable to set the current directory back to original state after launching the program?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?