There is a certain application that I would like to check on whether the file is open. Basically the macro requires that this application is open before I do anything. Otherwise, I would put the message that the program is not open.
What is the best way to approach this problem?
Thank you for reading.
Determine if a file is open
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Determine if a file is open
To check an app is open you can usually just use IfWindowOpen with the window title (or partial title). To check a file is open will depend more on how the app works, or what type of file it is. We'd need more info to figure that out.
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: Determine if a file is open
Given to me by JRL and modified to suit my specifics... basically I use this to check if quickbooks is open and if it is I close it before opening clean. If it's not open the script simply opens it. hope this helps.
Code: Select all
Let>Looptimes=0
Label>CheckQuickBooks
ProcessExists>QBW32.EXE,vQuickBooksRes
If>vQuickBooksRes=True
KillProcess>QBW32.EXE
Add>LoopTimes,1
If>LoopTimes>10
MDL>QuickBooks is failing to close. Exiting script
Exit>0
EndIf
Wait>0.5
Goto>CheckQuickBooks
EndIf
Label>QuickBooksLogin
Let>tmp0=Q:\my qb file.qbw
ExecuteFile>tmp0,
WaitWindowOpen> QuickBooks*
Wait>3
SetFocus>QuickBooks*