Run Program - More Elegant

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
ccris
Newbie
Posts: 19
Joined: Fri Aug 27, 2010 1:53 pm

Run Program - More Elegant

Post by ccris » Thu Apr 05, 2012 3:08 pm

Hi,

I am trying to run a quirky utility that will only start "when started from its own directory".

(I subsittuted actual name of directories with yyy and xxx)
The complete path is: C:\Program Files\yyy\xxx\Utility.exe

If I
Run>C:\Program Files\yyy\xxx\Utility.exe
the program replies with an error box: "The Utility must be run from xxx installation Directory".

I have found one clunky way of getting this done: by going to CMD, doing a CD, send>Utility.exe, ENTER, close CMD.

Code: Select all

Run>CMD /k cd C:\Program Files\yyy\xxx\
Wait>0.2
SetFocus>Administrator*
Send>Utility.exe
Press ENTER
WindowAction>3,Administrator*
I am wondering if this could be accomplished in a more elegant way, using the Run> command only?

Thanks,

CC

User avatar
JRL
Automation Wizard
Posts: 3518
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Apr 05, 2012 3:40 pm

There are several other ways you could do this. Try:

Code: Select all

Let>CWD=C:\Program Files\yyy\xxx\
Run>Utility.exe

ccris
Newbie
Posts: 19
Joined: Fri Aug 27, 2010 1:53 pm

Post by ccris » Thu Apr 05, 2012 6:45 pm

Thanks for quick reply.
Tried, MacSch generates the following error:
"Error executing Utility.exe (2:The system cannot find the file specified)".

I stepped through lines and see that in system variable CWD, path was set correctly.
However, the run command did not seem to utilize the path contained in system variable CWD.

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Thu Apr 05, 2012 7:10 pm

Try:

Code: Select all

Change Directory>C:\Program Files\yyy\xxx\
Run>Utility.exe

User avatar
JRL
Automation Wizard
Posts: 3518
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Apr 05, 2012 7:10 pm

Sorry, my test worked without the path on the Run> line. Guess it isn't always so.

Try adding the full path to the run line:

Code: Select all

Let>CWD=C:\Program Files\yyy\xxx\
Run>C:\Program Files\yyy\xxx\Utility.exe
Or try me_again's code

ccris
Newbie
Posts: 19
Joined: Fri Aug 27, 2010 1:53 pm

Post by ccris » Fri Apr 06, 2012 4:27 pm

Quick feedback:

"Try adding the full path to the run line:"
Did not work, same error.

However,
Me_again's suggestion
Change Directory>
worked.

So simple! (I didn't even know "Change Directory>" was there...)

Thanks again to all!

CC

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts