Preventing multiple instances of a Windows app - still a problem
Mark Schonewille
m.schonewille at economy-x-talk.com
Sun Dec 4 18:30:32 EST 2011
Graham,
What is the execution error exactly?! Please, always include the exact text of an error, whenever you write the word 'error'.
--
Kind regards,
Mark Schonewille
Economy-x-Talk
Http://economy-x-talk.com
Share the clipboard of your computer over a local network with Clipboard Link http://clipboardlink.economy-x-talk.com
Op 5 dec. 2011 om 00:24 heeft Graham Samuel <livfoss at mac.com> het volgende geschreven:
> Finally, Mike gave me this little script in May - I tried to put it in a field and 'do' it as vbscript. Didn't works so then I put it in a text file, read it and tried do as vbscript again. Both times I got an execution error. Maybe it's just too late at night…
>
> 'sets the environment
> Set WshShell = WScript.CreateObject ("WScript.Shell")
>
> 'grabs the full processlist and puts it in a var
> Set colProcessList = GetObject("Winmgmts:").ExecQuery ("Select * from
> Win32_Process")
>
>
> 'loops through each looking for a match
> For Each objProcess in colProcessList
> If objProcess.name = "firefox.exe" then
>
> 'sets a flag if a match is found
> vFound = True
> End if
>
> 'next loop of course
> Next
>
> 'if a match was found, activate the app
> If vFound = True then
> WshShell.AppActivate "firefox"
> Else
>
> ' otherwise, run the app
> WshShell.Run "firefox.exe"
> End If
More information about the use-livecode
mailing list