skyhigh

How to check if a process is responding?

16 posts in this topic

I wrote a script based on a loop. I want my script to check at the start of every cycle if one or more processes are still running and responding, then react if they are no more. I can do the former using ProcessExist, but how about the latter?

Does exist a function that verifies if a process is still responding?

Thanks in advance

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Process "responding" is going to be different depending on the process. What is the process, and what defines that it is still working (writing to a db, output to a file, etc. etc.)?

You can always use ProcessGetStats, to return an array of the operations performed, and compare from loop to loop (e.g. if number of read operations between loop 1 and 2 has increased by at least x%)

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Per this post, you are trying to monitor Firefox and the Flash plugin. Can you provide a link to the site you are trying to interact with?

Edited by Danp2
Fixed link

Share this post


Link to post
Share on other sites

Per this post, you are trying to monitor Firefox and the Flash plugin. Can you provide a link to the site you are trying to interact with?

From that, how do you deduce "trying to monitor Firefox and the Flash plugin"?


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

From that, how do you deduce "trying to monitor Firefox and the Flash plugin"?

You really can't see how I came to the conclusion? :shifty:

P.S. Corrected link!

Share this post


Link to post
Share on other sites

I wonder if this involves a Flash game...

:'(

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Per this post, you are trying to monitor Firefox and the Flash plugin. Can you provide a link to the site you are trying to interact with?

Thank you for yor help.

Here some examples

http://www.twitch.tv/

http://vimeo.com

and more streaming sites using flash plugin.

Here is the background, a description of the script I am coding:

A script to open Firefox and go to a random URL. The url changes randomly every X minutes between 12.00 Pm and 4.00 Pm through a loop.

I want to make my script to be as indipendent as possible. To do so I need it to check if:

- Firefox is still working and responding (working on my on my own)

- Adobe Flash plugin is still working

- Plugin-container is still working

- ?Others sensible processes able to compromise the script?

Also, I am not sure what is better, to perform the check at the beginning of the loop or to perform it regularly, i.e every 5 minutes.

 

EDIT: NOPE: I am working on streaming sites only, no bots involved :)

Edited by skyhigh

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

maybe https://www.autoitscript.com/forum/topic/116592-checking-if-process-is-suspendedhangednot-responding/
https://www.autoitscript.com/forum/topic/111679-how-to-know-if-a-process-is-not-responding/

I read in stackoverflow:

There is no general solution to this problem.

It is impossible to tell if a particular process is hanging or not, because the term "hanging" is entirely dependent upon the context of the process that is executing.

The hanging process will always do what it was coded to do. The developer may have coded it badly, but Windows can't make assumptions about what is right/wrong.

Possible ideas to try might be:

  1. The Process.Responding call will indicate whether or not a process that is executing a windows message loop is responding.

  2. One possible solution for the more general case might be to poll the memory usage for the process at intervals and if it doesn't change after enough time, assume that it is hung. You could do this with Process.WorkingSet64. However, I expect that this would cause a number of false positives - stable processes that are not processing anything might appear to be hanging. It would also cause false negatives where a hanging process that had a memory leak would appear to be doing something useful, when in fact it was stuck in a loop.

  3. If the process writes to the StandardError/StandardOutput streams (as many console applications do), then you could try listening for such output: Process.BeginOutputReadLine and Process.BeginErrorReadLine. If there is no such output within a given period, you might deduce that it has hung.

Edited by argumentum

Share this post


Link to post
Share on other sites

Thank you for your answer, argumentum. I am studying it and I will try your suggestions.

1 person likes this

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Well, I am still alive and so is my script.
After the information you gave me I have performed some searches through the net. I have found a software that could be useful to me: Kiwi Application Monitor. It has a free and a paid version. The paid version is the most interesting one because it allows you to set advanced rules for specific processes. The rules are not different from scripts created through a GUI:

u2bCBZj.jpg

As you can see from the screenshot Kiwi has even a way to know if a process is responsive or not, which seems exactly what I am looking for. Unfortunately Kiwi has not a trial version, so I can't try its full power.
If I buy it my problem will change: I'll need to manage the interaction between my autoit script and Kiwi . I am thinking about it, but it does not look to be a simple task. While I would solve the main problem (what to if FF stop responding or crashes) I have not figured out yet how to tell autoit that a third part software is closing or rebooting FF. I don't think a specific process would appear in these cases.

What do you think about it?

 

 

Edited by skyhigh

Share this post


Link to post
Share on other sites

I think it's an advertisement for paid software.

You have not even tried to implement this yourself, even though everything in that screenshot is easily done in AutoIt.

So yes, an advertisement , that's what I think about it.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Do you think it's spam? I can understand your reasons but you are totally wrong. To be clear, I have just asked to a mod if I ought to edit the name of the software from the post and from the screenshot. If he will tell me to do it, I will execute immediately.

But I will not give up the core of my question.

I began to work on this script months ago. I wrote it one piece at time, some parts of it thanks to the people of this forum. I do not have much time to dedicate to it but I really want to complete my script.

The last answer from @argumentum clearly says that there is no a definitive and easy way for autoit to do what I need. Paying some dollars could save me from spending a lot of time of study and trial-and-error scripting. In this case I'll be glad to pay!

But if you do know better than him please, go on and tell me, explain to me: because I would be even gladder if I spare some bucks.

 

 

 

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

There have been many suggestions here in this thread, you've come back after a while posting a third party app, but you have not tried any of the suggestions or at least not posted what you tried, and that's what makes me think it's just an ad.

But I'm just a person on the internet who answered your question, you can safely ignore me.

And that screenshot does not mention a process at all, just app, it's most likely using some or all of the approaches mentioned here.

EDIT: And here's another thought, when a process stops working, windows generally notifies you off it "Blah has stopped working, close, debug, send error report" etc...

EDIT2:

Can you clarify what "non responsive" means from a system point of view? What exactly is Kiwi looking for with this condition?

It's like pinging a server: Kiwi sends a command to an application GUI to which she responds. If the application does not respond, it either froze or is under heavy processing. So if you include the "above 90% processor load" rule, you can rule the last occasion out.

http://www.kiwimonitor.com/forum/viewtopic.php?f=4&t=95

In other words "_WinAPI_IsHungAppWindow"

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

The last answer from @argumentum clearly says that there is no a definitive and easy way for autoit to do what I need.

lol, nope, I said what's written. And looking at the website, the app. they show, can be perfectly written in AutoIt.
As far as "an easy way", well, the code has to be written. It certainly is time consuming.
The money the ask is not much, go for it. But I feel, it will not satisfy your wanting.

Anywayz, just wanted to clarify and give my 2 cents.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • u01jmg3
      By u01jmg3
      HotKeySet("^``", "toggle_media_controls") ; Ctrl + ` While 1 Sleep(100) WEnd If Not ProcessExists("wmplayer.exe") And RegRead("HKCU\Software\Microsoft\MediaPlayer\Preferences", "HoverTransportsEnabled") = 1 Then ; Disable autohide controls RegWrite("HKCU\Software\Microsoft\MediaPlayer\Preferences", "HoverTransportsEnabled", "REG_DWORD", "0") EndIf Func toggle_media_controls() Local $sVar = RegRead("HKCU\Software\Microsoft\MediaPlayer\Preferences", "HoverTransportsEnabled") If ProcessExists("wmplayer.exe") Then If $sVar = 0 Then ; Enable autohide controls RegWrite("HKCU\Software\Microsoft\MediaPlayer\Preferences", "HoverTransportsEnabled", "REG_DWORD", "1") Else ; Disable autohide controls RegWrite("HKCU\Software\Microsoft\MediaPlayer\Preferences", "HoverTransportsEnabled", "REG_DWORD", "0") EndIf EndIf EndFunc How do I amend this code so that without pressing a hotkey, after Windows Media Player is not running, the regkey above is set to 0?
      My function and hotkey all work without issue
    • JuanFelipe
      By JuanFelipe
      Gentlemen Good morning, today I ask you a little help to you with a check I'm trying to do, it is I want to run a .exe that I did, what I do is that before running check if it is already that open, am using ProcessExists, but what happens is that I just to run first mistake, I tried to do it in different ways, but I'm not.
      $proceso = ProcessExists("aceptar ventanas business.exe") If $proceso > 2 Then MsgBox(16,"Error","Ya esta abierto") Else while 1 If WinExists("Recuperando los datos...")Then WinActivate("Recuperando los datos...") Send("{enter}") Else EndIf WEnd EndIf