Check for running application in Windows
Magicgate Software - Skip Kimpel
skip at magicgate.com
Fri Jun 20 12:46:29 EDT 2014
Paul, you are the BEST!
Thank you... it works perfectly.
SKIP
On Fri, Jun 20, 2014 at 12:14 PM, Paul Dupuis <paul at researchware.com> wrote:
> On 6/20/2014 12:09 PM, Magicgate Software - Skip Kimpel wrote:
> > Good afternoon!
> >
> > Is there a way to check to see if there is a program currently running
> on a
> > Windows machine? For instance, I want to verify that a 3rd party piece
> of
> > software is currently running (not just installed) before proceeding with
> > my LC script.
> >
> > As usual, your comments and suggestions are always appreciated!
> >
> > SKIP
>
> Use the function below to return a cr delimited list of running programs
> and then filter the list to see if the app you are interested is on it
> or not.
>
> function runningPrograms
> local myList, myColPos, myNewList
> switch platform()
> case "MacOS" -- OSX Only
> put shell("ps -xcw") into myList
> put offset("COMMAND",myList) into myColPos
> repeat for each line myLine in myList
> put char myColPos to -1 of myLine & cr after myNewList
> end repeat
> filter myNewList without "(*"
> return line 2 to -1 of myNewList
> break
> case "Win32"
> set the hideConsoleWindows to true
> put shell("tasklist /V /FO ""e&"CSV""e) into myList -- or
> use the pv command
> set the hideConsoleWindows to false
> delete first line of myList -- remove header
> repeat for each line myLine in myList
> put item 1 of myLine & cr after myNewList -- item 1 =
> "programname.exe"
> end repeat
> return myNewList
> break
> default
> return empty
> end switch
> end runningPrograms
>
>
> _______________________________________________
> 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