View previous topic :: View next topic |
Author |
Message |
marcelo Contributor
Joined: 10 May 2008 Posts: 140
|
Posted: Fri Jun 09, 2017 12:24 pm Post subject: Tasklist in windows 7 64 bits |
|
|
Hi. I'm running a little program i wrote originally for win xp in an actual machine running Win 7 64 bits and i find a problem.
This proggy creates a List with TASKLIST and check if a specific process is running (example: chrome.exe)
It works fine in XP but here, in 7 64bits, the list only contains VDS.EXE
Here is a little example
Code: |
run C:\Program Files (x86)\Google\Chrome\Application\chrome.exe http://www.google.com.ar
wait 5
list create,1
list tasklist,1
if @match(1,Chrome.exe)
Info Running
else
Info Not running
end
list close,1
|
If i add "List savefile,1,Tasks.txt" this txt file only contains VDS.EXE
Is it a a problem with TASKLIST and Win 7? or 64Bits? Is there any other way to do something like this?
|
|
Back to top |
|
|
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Fri Jun 09, 2017 4:32 pm Post subject: |
|
|
Have you tried using @winexists() and using the class name to see if it's running.
I see three class names for my Chrome running right now on 64bit Windows 10, of which two might be usable:
#Chrome_WidgetWin_1
#Chrome_RenderWidgetHostHWND
the third one is #Intermediate D3D Window
If you open another tab, you get another instance of #Chrome_RenderWidgetHostHWND showing and #Chrome_WidgetWin_1 still shows.
So I believe that the first two would suffice for your needs(unless some other program is using the same class names). In fact, I'd suggest doing a
Code: | RUN C:\Program Files (x86)\Google\Chrome\Application\chrome.exe http://www.google.com.ar
WAIT 5
IF @both(@winexists(#Chrome_WidgetWin_1),@winexists(#Chrome_RenderWidgetHostHWND))
INFO "Running"
ELSE
INFO "Not running"
END |
~Garrett
_________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
Back to top |
|
|
GregLand Valued Contributor
Joined: 15 Jun 2004 Posts: 212 Location: FRANCE
|
Posted: Sat Jun 10, 2017 10:22 am Post subject: |
|
|
Hi
Could you try this function ?
Work with 7 until 10 french (don't know for XP)
Code: |
#DEFINE function,checkprocess
%A = @checkprocess(chrome.exe)
# %A = 1 if running
# %A = 0 if not running
if @equal(%A,1)
info Running
elsif @equal(%A,0)
info NOT Running
else
Warn ERROR
end
EXIT
:checkprocess
IF %1
RUNH @chr(34)@windir(S)\cmd.exe@chr(34) /C tasklist /NH /FO CSV /FI @chr(34)IMAGENAME eq %1@chr(34) > @chr(34)@path(%0)temp.txt@chr(34),WAIT
%%LIST = @new(LIST)
LIST loadfile,%%LIST,@path(%0)temp.txt
OPTION fieldsep,","
PARSE "%%process;%%PID;%%type;%%chiffre;%%ram",@item(%%LIST,0)
LIST savefile,%%LIST,@path(%0)temp.txt
FILE delete,@path(%0)temp.txt
LIST close,%%LIST
%A = @equal(%%process,%1)
IF %A
%e = 1
ELSE
%e = 0
END
ELSE
%e = 0
END
EXIT %E |
Last edited by GregLand on Sun Jun 11, 2017 12:29 am; edited 3 times in total |
|
Back to top |
|
|
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Sat Jun 10, 2017 3:16 pm Post subject: |
|
|
With your code, it does return a "1" when Chrome.exe is running and "0" when it is not running. So no problem here on Windows 10(64bit) latest release/update.
_________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Last edited by Garrett on Mon Jun 12, 2017 4:22 pm; edited 1 time in total |
|
Back to top |
|
|
GregLand Valued Contributor
Joined: 15 Jun 2004 Posts: 212 Location: FRANCE
|
Posted: Sun Jun 11, 2017 12:25 am Post subject: |
|
|
I've just tried with a x64 XP and look work great.
if marcelo can confirm it !
Thanks !
|
|
Back to top |
|
|
marcelo Contributor
Joined: 10 May 2008 Posts: 140
|
Posted: Thu Jun 22, 2017 11:27 am Post subject: |
|
|
It works!!!!!
Thanks a lot!!!!
|
|
Back to top |
|
|
GregLand Valued Contributor
Joined: 15 Jun 2004 Posts: 212 Location: FRANCE
|
Posted: Thu Jun 22, 2017 2:32 pm Post subject: |
|
|
Cool !
Here's a DSU if needed
Code: | #INCLUDE checkprocess.dsu
#DEFINE function,checkprocess
%A = @checkprocess(notepad.exe)
%A = 1 if process running
%A = 0 if process not running |
Description: |
|
Download |
Filename: |
checkprocess.dsu |
Filesize: |
609 Bytes |
Downloaded: |
1435 Time(s) |
|
|
Back to top |
|
|
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
Posted: Tue Jun 27, 2017 6:17 pm Post subject: |
|
|
I have a similar function.
Code: |
:TaskExists
#windows XP Pro and above
if @not(%1)
error 2
end
runh tasklist /svc /FI @chr(34)imagename eq %1@chr(34),pipe
%l = @pipe()
if @greater(@pos(%1,%l),0)
%e = T
end
exit %e
|
_________________ Chris
Http://theblindhouse.com |
|
Back to top |
|
|
GregLand Valued Contributor
Joined: 15 Jun 2004 Posts: 212 Location: FRANCE
|
Posted: Tue Jun 27, 2017 10:34 pm Post subject: |
|
|
Yep ! Thanks ! Very shortest !
|
|
Back to top |
|
|
|