View previous topic :: View next topic |
Author |
Message |
Woody Valued Newbie
Joined: 10 Jul 2003 Posts: 29
|
Posted: Thu Apr 13, 2006 3:39 pm Post subject: Check the status of a task??? |
|
|
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 |
|
|
Woody Valued Newbie
Joined: 10 Jul 2003 Posts: 29
|
Posted: Thu Apr 13, 2006 4:20 pm Post subject: Re: Check the Status of a task??? |
|
|
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 |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Fri Apr 14, 2006 3:04 am Post subject: |
|
|
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
serge _________________
|
|
Back to top |
|
|
Woody Valued Newbie
Joined: 10 Jul 2003 Posts: 29
|
Posted: Fri Apr 14, 2006 2:48 pm Post subject: Re: Check the Status of a task??? |
|
|
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 |
|
|
Woody Valued Newbie
Joined: 10 Jul 2003 Posts: 29
|
Posted: Fri Apr 14, 2006 3:16 pm Post subject: Re: Check the Status of a task??? |
|
|
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 |
|
|
|