Preventing multiple instances of a Windows app - still a problem

Mike Bonner bonnmike at gmail.com
Sun Dec 4 10:01:35 EST 2011


Since you just want to kill the process, and not necessarily bring it to
the front or anything like that, I think this is great advice. Just kill it
through shell, shouldn't matter if its actually running or not.

However, on the vbscript side I found a MUCH easier way to see if the
process is running.

Do the following as vbscript. (can run it direct, no need for a tmp file or
anything)

Set colProcessList = GetObject("Winmgmts:").ExecQuery ("Select * from
Win32_Process WHERE Name = 'System Idle Process'")
result = colProcessList.Count

If the result is > 0 the process is running. Note the single quotes around
my process name.




> Did you tried this way:
>
> 1)
>   get "tasklist /NH /FI  " & quote & "IMAGENAME eq firefox.exe"  & quote
>   put shell( IT )
>   -- or process the shell() output
>
> 2)
>   get "tasklist /NH /FI  " & quote & "IMAGENAME eq Troubling\ App.exe"  &
> quote
>   put shell( IT )
>
>
> Solution 1, I'm sure it works
> Solution 2, didn't test it.
>
> HTH,
>
> Thierry
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list