| View previous topic :: View next topic |
| Author |
Message |
tgross Newbie
Joined: 03 Apr 2007 Posts: 4
|
Posted: Thu May 10, 2007 7:33 pm Post subject: exe already running |
|
|
Does anybody know how to detect if a vds .exe is already running? I tried using the following code:
LIST CREATE,1
LIST TASKLIST,1
IF @MATCH(1,Utility.exe)
STOP
END
but realized, duh, that since the script was running it would show up in the list. I can't find a way to detect a duplicate item in the list.
I'm kind of a newbie so please be kind  |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu May 10, 2007 8:33 pm Post subject: |
|
|
I think this is the easiest way:
| Code: |
REM Check if our window already exists
if @winexists(#AlreadyRunningWnd)
REM If it does, show it and then exit
window activate,@winexists(#AlreadyRunningWnd)
exit
end
REM If it doesn't, then go ahead with our window
REM Make sure to specify the CLASS of the window. This is what we check above.
DIALOG CREATE,New Dialog,-1,0,240,160,CLASS AlreadyRunningWnd
REM If you don't want your exe to have a window, don't show it.
DIALOG SHOW
:evloop
wait event
goto @event()
:Close
exit
|
_________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Fri May 11, 2007 1:44 pm Post subject: |
|
|
Another approach is the way you already told, by looking if an item is in a list multiple times. Although this might work, I think it's best for you to go with SnarlingSheep's example since that will rule out other applications which are using the same exe name.
| Code: | list create,1
list add,1,a first
list add,1,b
list add,1,b
list add,1,b
list add,1,b
list add,1,a second
list add,1,b
# Set the list index to zero
list seek,1,0
# Check for the first item
if @match(1,a)
# With @next(), the list index will be incremented
info First match found: @next(1)
end
# Check if there is a second match found (or maybe even more?)
if @match(1,a)
# A second match has been found, you now know for sure an item is in the
# list multiple times
info Second match found: @next(1)
end |
_________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
| Back to top |
|
 |
tgross Newbie
Joined: 03 Apr 2007 Posts: 4
|
Posted: Fri May 11, 2007 7:51 pm Post subject: |
|
|
Thanks.
The @WINEXISTS solution worked. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|