Graham,

On XP try the 'qprocess' command. It should be available and provides similar 
info.

put shell("qprocess")

Best -
Phil Davis


On 12/4/11 3:24 PM, Graham Samuel wrote:
Thanks to all those who replied to my query - I appreciate both the speed and 
the enthusiasm of the replies! So far I have not succeeded, but I am more than 
ready to believe that it's finger-trouble on my part.

To take Mark Schonewille's suggestions first:

1. As I stated in my original post, I am trying to prevent multiple instances 
of a non-LC application, so thanks but sadly 'relaunch' won't touch the problem 
as far as I can see - I think 'relaunch' is actually implemented as a LC engine 
(or inter-engine) activity.

2. Also sadly you are right and 'tasklist' is not available in Windows XP Home, 
which I am using and which I'm certain a good many of my users will be using 
too. When I do

   put shell("tasklist")

I get

   'tasklist' is not recognized as an internal or external command, operable 
program or batch file.

Next, Thierry Douez:

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.
Same problem - can't access 'tasklist'. And actually I don't understand what 
this script does. Presumably the parameters NH and FI do the killing?

Next, Mike Bonner - again can't use tasklist, but there is a glimmer of hope in 
your remark

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.
Can I kill the process without using 'tasklist'? Since I apparently don't need 
to know if the process is in the list or not, could I go direct to 'kill' or 
whatever it's called in Windows? I tried

put shell("kill FireFox.exe") but it seems 'kill' wasn't recognised, nor was 
'pskill' - I have a list of Windows Command-line commands via Google in which these are 
included but it seems that my 'shell' doesn't invoke them.

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




_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


--
Phil Davis

PDS Labs
Professional Software Development
http://pdslabs.net


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to