-1

I'm a relative newbie with Autohotkey but I'm fairly certain this is not supposed to happen. When I use the 'reload' command, an infinite loop begins. As far as I can tell, it is a loop of whatever script invoked it. But it won't stop unless I use Taskkill. Actually, Task Manager might work but I haven't tried it. I'm running Windows 10 21H2. AHK is ver 1.1.34.03. I have tried a diagnostic boot of windows (almost no running apps) and I have also uninstalled and reinstalled AHK. Result remains the same.

I have a script that is only

Reload

msgbox, 4096, , Pausing

(There isn't really a blank line in there. Without it, the editor made it into a single line.)

My assumption was that msgbox would stop any loop. What actually happens is that the program begins to loop, flashing the msgbox momentarily. This goes on and on. I'm unable to stop it with the ahk icon because it also appears and disappears (in the hidden icons tray), so fast that I cannot click it. Only thing I have killed it with is taskkill.

Any suggestions?

-----Paul-----

pwright2
  • 11
  • 2
  • 1
    Reload is automatically executed every time the script starts, so I don't really see how there could be any other outcome except an infinite reloading loop. What are you trying to do? – 0x464e Jul 20 '22 at 19:42
  • Being a script it automatically executes until it hits a return/exit command. Suggestion, set reload to a hotkey. – T_Lube Jul 22 '22 at 06:55
  • It was intended to simply ensure that the newest version of the script was running. I have since discovered #singleinstance which seems to do the job. But I am still confused about the intended use of Reload. – pwright2 Jul 22 '22 at 21:21

1 Answers1

0

#SingleInstance is probably not really what you need for this. Normally Reload is used with a hotkey, or a timer that checks if the file has changed, then reloads it. Where I use this I have a script running in the background with many little scripts attached to hotkeys. When I save the script it reloads. Something like:

~^s:: ; pass through hotkey when saving
If winActive(A_Scriptname) {
   Reload
}
Return

Make sense?

(Above code is just an idea, which might work depending on what editor you are using)

T_Lube
  • 306
  • 1
  • 6