Thanks for your help sherri
I used your first script with a few tweaks
I need to handle two more things - when wmic returns more than one
process - I need to restart only the first result - where can I find
documentation on regex.pcrereplace ? (have not found it anywhere !)
and secondly , I need to split the command line from it's parameters
or else I get file not found on do() command - or is there any other
way to just run the whole line and be done with it ?
here's where I got so far :
local apphandle=win.handle("active")
local underapp=win.exename(apphandle)++".exe"
local wmicmd=?"/c wmic /output:clipboard process WHERE (name='"
++underapp ++"') GET commandline"
file.runwait(0, env("COMSPEC"), wmicmd, "", "hide")
local res=clip.get
win.close(apphandle)
wait.for(50,win.exists(apphandle)==0)
if (win.exists(apphandle))
win.closeforce(apphandle)
local commandline= regex.pcrereplace(?"CommandLine *\R\s*",res,"")
;win.debug("new cmd",commandline)
commandline= regex.pcrereplace(?"(.*)\R\s*",commandline,"$1") ;<--not
working
do(commandline) ;<todo - split command and params
quit
thanks for your help !
avi
--- In [email protected], "Sheri" <[EMAIL PROTECTED]> wrote:
>
> Seems wmic has an option to output to the clipboard, and if you use
> that you don't even need the pipe plugin to retrieve its output.
>
> i.e., wmic /OUTPUT:CLIPBOARD process WHERE [..etc..]
>
> Afterwards, you can retrieve the output with clip.get
>
> Regards,
> Sheri
>