Macro to test if specific program is open

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
randybass
Newbie
Posts: 5
Joined: Tue Jun 21, 2005 4:52 pm
Location: Dallas, Texas

Macro to test if specific program is open

Post by randybass » Sun Sep 25, 2005 11:00 pm

Please assist me with the following:

I am trying to create a Macro that will test to see if a program is open in Windows XP. If the program is currently open, do nothing and if the program is not open, run the program.

Any assistance would be appreciated.
Randy Bass
Dallas, Texas

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sun Sep 25, 2005 11:14 pm

What program are you running?
Does it normally have a window?
.....If YES, What is the title of the window?
Will the window title always be the same?
.....If NO, how does it change for different conditions?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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

Post by Me_again » Mon Sep 26, 2005 12:15 am

Depends what you mean by "open", if you just mean running you could test for its process name with isprocessrunning as described in this tip by support http://www.mjtnet.com/usergroup/viewtop ... essrunning

User avatar
tony_smith
Pro Scripter
Posts: 70
Joined: Wed May 14, 2003 8:25 pm
Location: Vancouver BC Canada

Post by tony_smith » Mon Sep 26, 2005 10:00 pm

Here is part of a script I use to test if the application Tppcsrvr is running. You can get pstools off the net as freeware, just Google it.

Also, ReadFile works faster, but... this ain't broke.

Remark> pslist.exe is part of PStools
Run Program>Cmd /c pslist tppc >U:\Reports\Temp\taskq.txt
Wait>5
Let>x=0
Label>START
Let>x=x+1
ReadLn>U:\Reports\Temp\taskq.txt,x,LINE1
If>LINE1=,START
If>LINE1=##EOF##,EML
Position>Tppcsrvr,%LINE1%,1,LINPOS
If>LINPOS=0,START
Label>EML

Hope this is helpful

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