forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Tasklist in windows 7 64 bits

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
marcelo
Contributor
Contributor


Joined: 10 May 2008
Posts: 140

PostPosted: Fri Jun 09, 2017 12:24 pm    Post subject: Tasklist in windows 7 64 bits Reply with quote

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
View user's profile Send private message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Fri Jun 09, 2017 4:32 pm    Post subject: Reply with quote

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
View user's profile Send private message
GregLand
Valued Contributor
Valued Contributor


Joined: 15 Jun 2004
Posts: 212
Location: FRANCE

PostPosted: Sat Jun 10, 2017 10:22 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Sat Jun 10, 2017 3:16 pm    Post subject: Reply with quote

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
View user's profile Send private message
GregLand
Valued Contributor
Valued Contributor


Joined: 15 Jun 2004
Posts: 212
Location: FRANCE

PostPosted: Sun Jun 11, 2017 12:25 am    Post subject: Reply with quote

I've just tried with a x64 XP and look work great.
if marcelo can confirm it !
Thanks !
Back to top
View user's profile Send private message Visit poster's website
marcelo
Contributor
Contributor


Joined: 10 May 2008
Posts: 140

PostPosted: Thu Jun 22, 2017 11:27 am    Post subject: Reply with quote

It works!!!!!
Thanks a lot!!!!
Very Happy Very Happy
Back to top
View user's profile Send private message
GregLand
Valued Contributor
Valued Contributor


Joined: 15 Jun 2004
Posts: 212
Location: FRANCE

PostPosted: Thu Jun 22, 2017 2:32 pm    Post subject: Reply with quote

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



checkprocess.dsu
 Description:

Download
 Filename:  checkprocess.dsu
 Filesize:  609 Bytes
 Downloaded:  1378 Time(s)

Back to top
View user's profile Send private message Visit poster's website
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1751
Location: Space and Time

PostPosted: Tue Jun 27, 2017 6:17 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
GregLand
Valued Contributor
Valued Contributor


Joined: 15 Jun 2004
Posts: 212
Location: FRANCE

PostPosted: Tue Jun 27, 2017 10:34 pm    Post subject: Reply with quote

Yep ! Thanks ! Very shortest ! Thumbs Up
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group