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 


Check the status of a task???

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced Help for VDS 5 & Up
View previous topic :: View next topic  
Author Message
Woody
Valued Newbie


Joined: 10 Jul 2003
Posts: 29

PostPosted: Thu Apr 13, 2006 3:39 pm    Post subject: Check the status of a task??? Reply with quote

I saw this question posted once before but there were no replies to it so here goes.

Does anyone know of a way in VDS or via using windows API to get the staus of a task. I need the ability to wait for an application to respond to a command prior to proceeding with the rest of the script.

Is there a way to check if an application is in a "busy" state?

Thank you for any assistance.

_________________
- Woody
Back to top
View user's profile Send private message AIM Address
Woody
Valued Newbie


Joined: 10 Jul 2003
Posts: 29

PostPosted: Thu Apr 13, 2006 4:20 pm    Post subject: Re: Check the Status of a task??? Reply with quote

Hey everyone,

I found a way to do it below is an example.

Code:

runh tasklist.exe /FI @chr(34)IMAGENAME eq notepad.exe@chr(34) /FI @chr(34)STATUS eq not responding@chr(34), PIPE
%P = @pipe()
info %P


then of course once it is responding continue the script...

_________________
- Woody
Back to top
View user's profile Send private message AIM Address
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Fri Apr 14, 2006 3:04 am    Post subject: Reply with quote

it's a great feeling when you find your own answer ... the only reason people don't answer is because they have nothing to contribute ... not because they want to ignore you or anything like that

judging by your pic, you must based on the moon Wink

serge

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Woody
Valued Newbie


Joined: 10 Jul 2003
Posts: 29

PostPosted: Fri Apr 14, 2006 2:48 pm    Post subject: Re: Check the Status of a task??? Reply with quote

Woody wrote:
Hey everyone,

I found a way to do it below is an example.

Code:

runh tasklist.exe /FI @chr(34)IMAGENAME eq notepad.exe@chr(34) /FI @chr(34)STATUS eq not responding@chr(34), PIPE
%P = @pipe()
info %P


then of course once it is responding continue the script...


The only problem with this appears to be that the task I need to wait for is busy. Using tasklist.exe it will return if the task is running or not responding.

Next I will try to utilize the MEMUSAGE filter to determine if it will reflect the application being busy. If I can use the memusage differences between busy and idle it may work out.

.... More to come

_________________
- Woody
Back to top
View user's profile Send private message AIM Address
Woody
Valued Newbie


Joined: 10 Jul 2003
Posts: 29

PostPosted: Fri Apr 14, 2006 3:16 pm    Post subject: Re: Check the Status of a task??? Reply with quote

I think this is getting close to ironed out...

Code:

#DEFINE FUNCTION,MemUsage

  # Get the current memory usage for the application
  %%CurrentUsage = @MemUsage()
  # Check to see if the application is busy if so wait
  while @greater(@MemUsage(),%%CurrentUsage)
  wait .5
  wend

:MemUsage
runh tasklist.exe /FI @chr(34)IMAGENAME eq notepad.exe@chr(34) /FI @chr(34)STATUS eq running@chr(34) /FO list, PIPE
%p = @pipe()
option fieldsep, @CR()
parse "%%Zero;%%Image;%%PID;%%Session;%%SessionNum;%%MemUse",%P
option fieldsep, " "
parse "%M;%U;%%Value;%K",%%MemUse
option fieldsep
exit %%Value


[/code]

_________________
- Woody
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced Help for VDS 5 & Up 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