Second copy of app launching

Ken Ray kray at sonsothunder.com
Tue Jan 24 12:15:09 CST 2006


On 1/24/06 11:29 AM, "Ray Horsley" <ray at linkitonline.com> wrote:

> This could be an old topic.  Does anyone have a way to detect if a copy
> of an application is open?  I need this to prohibit launching my app
> when a copy of it is already running.  It's only a problem on Windows
> since the Mac OS simply brings the already open app to the front
> instead of launching a second copy.  A list of all open applications
> would be nice.

There's a tip about how to get a list of running applications here:

  http://www.sonsothunder.com/devres/revolution/tips/proc002.htm

For Windows, it uses a command-line utility to get the running apps. If
you'd rather use VBScript, you can use this script (watch line wraps):

Set ProcessSet = 
GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery("select *
from Win32_Process")

tList = ""
For each Process in ProcessSet
    if Process.ExecutablePath <> "" Then
        tList = tList & "Process.Caption" & vbcrlf
    End If
Next
WScript.Echo tList

And then execute it using the hint for running VB Scripts from Revolution
(look at the "SendToXML" handler for how to wrap up VBScript into a form
that can be executed) in this tip:

  http://www.sonsothunder.com/devres/revolution/tips/iac001.htm


Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com
 



More information about the metacard mailing list