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?
Endless startup loop
Re: Endless startup loop
Can you post the script?
Re: Endless startup loop
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.
--------------------------------------------------
#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.
Re: Endless startup loop
I should add: I ran the script on an older version of AHK => no problem
Re: Endless startup loop
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.
and the script did fine; the endless looping stopped. I presume the problem is in one of those code sections.
Who is online
Users browsing this forum: todd and 149 guests