Preventing multiple instances of a Windows app - still a problem

Thierry Douez th.douez at gmail.com
Sun Dec 4 09:36:41 EST 2011


Hi Graham,

2011/12/4 Graham Samuel <livfoss at mac.com>

>
> Last May I got lots of good advice from this list (specially from Mike
> Bonner) about how to deal with this problem, and it came down to running a
> little VB script that ran through the open processes on the machine and
> killed any duplicate of the program in question: this is not the absolutely
> ideal solution, which would be to tell the LiveCode script that an instance
> already exists so that the launch won't be needed, but it is workable.
> Except for one show-stopper: in the example above I chose 'Troubling App'
> as a name, **because it has a space in it**. It turns out the VB script I
> was given worked fine for 'Firefox' for example, but didn't work for any
> program name with a space in it - this despite my enclosing the statement
> referring to the program in quotes, as in:
>

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



More information about the Use-livecode mailing list