How to restart macro when it stalls?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ParisPulvinar
Posts: 27
Joined: 27 Mar 2017, 07:45

How to restart macro when it stalls?

31 Mar 2017, 12:09

If there is a problem while running the macro it currently stalls when I'm running it as an exe file. Then I would need to close it and restart it. Is there a way to automatically restart the macro when it stalls?
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: How to restart macro when it stalls?

31 Mar 2017, 12:51

Once it gets 'brain-dead' I doubt that there's a kind of self-healing option. Let's guess it needs a little help from a friend eg another script that monitors it in parallel (probably you can detect a stalled scripts status/process like using the task manager).
Good luck.
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: How to restart macro when it stalls?

31 Mar 2017, 13:01

What do you mean it stalls? I think you have other tasks at hand if that's the case.
ParisPulvinar
Posts: 27
Joined: 27 Mar 2017, 07:45

Re: How to restart macro when it stalls?

31 Mar 2017, 13:30

I have a macro that searches a database and when it finds the record then it opens it up and everything runs smoothly. But when the macro can't find the record and it continues with the script to open the record but the record doesn't exist and the macro stops working.
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: How to restart macro when it stalls?

31 Mar 2017, 13:35

Still does not give us much information to go on as to what the root cause is.
Why does it stop working? You said something about an EXE file - does it run an EXE which never exits because of the problem?

Can you not just detect if the search didn't return anything and then not try to do the next bit?
You said "Everything opens up" - What opens up? Some windows?
Can you not check for existence of the window before trying to do the 2nd step?
ParisPulvinar
Posts: 27
Joined: 27 Mar 2017, 07:45

Re: How to restart macro when it stalls?

31 Mar 2017, 13:58

Yes, the exe file does not exit when there is a problem.

How do you check the existence of a window before the next step?

I was hoping for the macro to stop running or reset itself after a certain time period of waiting.
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: How to restart macro when it stalls?

31 Mar 2017, 15:26

ParisPulvinar wrote:I have a macro that searches a database and when it finds the record then it opens it up and everything runs smoothly. But when the macro can't find the record and it continues with the script to open the record but the record doesn't exist and the macro stops working.
Once the script fails to find a record it has to quit/get out of the loop/offer an alternative ... so where's your script?
ParisPulvinar
Posts: 27
Joined: 27 Mar 2017, 07:45

Re: How to restart macro when it stalls?

31 Mar 2017, 15:50

How do you know when you can't find a record?
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: How to restart macro when it stalls?

31 Mar 2017, 17:11

ParisPulvinar wrote:How do you know when you can't find a record?
We don't even know what database you are using, the AHK code you run the query with, how you issue the query, what the SQL of the query is...

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], Raymondbit and 378 guests