Endless startup loop

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
rmwolfe
Posts: 12
Joined: 10 Jan 2017, 11:38

Endless startup loop

19 Nov 2017, 10:03

I've been using AHK for at least 10 years. My Win 10 computer got the OS corrupted, and OS had to be reloaded. When I installed the latest AHK and tried running my old AHK script by double-clicking or drag-and-drop, it goes into an endless loop, with infinite copies opened; computer freezes.

What's going on? Did AHK change recently and something needs to be added to the top lines to prevent endless looping?
User avatar
boiler
Posts: 16957
Joined: 21 Dec 2014, 02:44

Re: Endless startup loop

19 Nov 2017, 10:22

Can you post the script?
rmwolfe
Posts: 12
Joined: 10 Jan 2017, 11:38

Re: Endless startup loop

19 Nov 2017, 20:44

Here is the top of the script; the rest is straightforward commands: Send, Sleep, Click, a few messageboxes. Nothing fancy.
--------------------------------------------------
#Hotstring EndChars -(){}:;'"\,.?! `n `t
DetectHiddenWindows, On
DetectHiddenText, On

; Note You must put a "send" in front of variable; cannot use on same line as hotkey
SetTimer, ReloadScriptIfChanged, 1000 ; this automatically reloads the file when it's changed and then saved
ReloadScriptIfChanged:
{
FileGetAttrib, FileAttribs, %A_ScriptFullPath%
IfInString, FileAttribs, A
{
FileSetAttrib, -A, %A_ScriptFullPath%
TrayTip, Reloading Script..., %A_ScriptName%, , 1
Sleep, 1000
Reload
TrayTip
}
Return
}

-----------------------------

Someone wrote that this line can stop duplications:
#SingleInstance force ;If this script is already running, terminate it and load a new instance

I'm not sure I want endless terminations and reloads, but if this does the trick, fine.
rmwolfe
Posts: 12
Joined: 10 Jan 2017, 11:38

Re: Endless startup loop

19 Nov 2017, 21:04

I should add: I ran the script on an older version of AHK => no problem
rmwolfe
Posts: 12
Joined: 10 Jan 2017, 11:38

Re: Endless startup loop

19 Nov 2017, 21:20

I also removed the SetTimer, ReloadScriptIfChanged lines, and added #SingleInstance force
and the script did fine; the endless looping stopped. I presume the problem is in one of those code sections.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: sachinme and 353 guests