Stopping a compiled script from running more than once

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
Phil Pendlebury
Automation Wizard
Posts: 538
Joined: Tue Jan 16, 2007 9:00 am
Contact:

Stopping a compiled script from running more than once

Post by Phil Pendlebury » Thu Jul 07, 2022 5:16 am

Compile script which contains on line 1:

Code: Select all

ProcessExists>NAME OF COMPILED SCRIPT.exe,res
The idea was to check if the exe was running and if it was, do not allow it run again.

The problem is of course logical failure, in that in order to check if it exists, it already exists. So the app will never start.

So I ended up having to create a "isrunning" file on start of run and then check for that file, (and then delete the file when the app is closed). If the file exists do not let the app run any further.

Of course the issue here is that if the app is force closed for some reason, or while I am testing within MS using debug stop, the "isrunning" file doesn't get deleted and therefore subsequent runs are not allowed...

Was just interested how you guys deal with this?
Phil Pendlebury - Linktree

User avatar
Grovkillen
Automation Wizard
Posts: 1009
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: Stopping a compiled script from running more than once

Post by Grovkillen » Thu Jul 07, 2022 10:05 am

Use the hidden/zero size dialog trick JRL came up with. If the dialog is found you know you have a process running already.
Let>ME=%Script%

Running: 15.0.24
version history

User avatar
Phil Pendlebury
Automation Wizard
Posts: 538
Joined: Tue Jan 16, 2007 9:00 am
Contact:

Re: Stopping a compiled script from running more than once

Post by Phil Pendlebury » Thu Jul 07, 2022 11:38 am

JRL to the rescue once again... Will search and find. Thank you. :)
Phil Pendlebury - Linktree

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