I'm pretty sure this is a bug. It appears to only affect compiled scripts.
I get this error:
---------------------------
AHKInstallOldVersion.exe
---------------------------
Error: Break/Continue must be enclosed by a Loop.
Line#
---> 066: Continue
The program will exit.
---------------------------
OK
---------------------------
when running this compiled script (a tweaked version of AHKLiveUpdate by Rajat):
Code:
DetectHiddenWindows On
;___________________________________________
; CONFIGURATION AREA
DownloadURL = http://www.autohotkey.com/download
DownloadFolder = %A_MyDocuments%\DLPrograms\AHK
;UnComment to save all keys
RegRead, RegCmp, HKEY_CLASSES_ROOT, AutoHotkeyScript\Shell\Compile\Command,
RegRead, RegEdt, HKEY_CLASSES_ROOT, AutoHotkeyScript\Shell\Edit\Command,
RegRead, RegOpn, HKEY_CLASSES_ROOT, AutoHotkeyScript\Shell\Open\Command,
RegRead, RegRun, HKEY_CLASSES_ROOT, AutoHotkeyScript\Shell\Run\Command,
;Scripts/programs to run after installation
Run1 = ;E:\dos\batch\AhkIcons.ahk
Run2 = ;E:\dos\batch\ManFriday.ahk
Run3 =
;Main Icon
MIco = C:\docutech\dstool\dt_test_5.ico
;Suspend Icon
SIco = C:\docutech\dstool\windows.ico
;Suspend Icon
PIco = c:\docutech\dstool\dstool_warning.ico
;Suspend + Pause Icon
SPIco = c:\docutech\dstool\dstool_warning.ico
;Version Resource path
VRes = C:\docutech\dstool\DSTool.res
;Path to ResHacker.exe
RHPath = C:\Program Files\AutoHotkey\ResHack\ResHacker.exe
;Path to Syntax file installer
STXPath = C:\Program Files\AutoHotkey\Extras\Editors\EditPlus
;Path to Editor STX Directory
EditSTXPath = C:\Program Files\EditPlus 2
AHKPath = %A_ProgramFiles%\Autohotkey
;___________________________________________
RunScripts = %Run1%`n%Run2%`n%Run3%
FileSelectFile,Installer,1,%A_MyDocuments%\DLPrograms\AHK\
IfNotExist, %Installer%, ExitApp
LatestVer = %Installer%
Process, Exist, AutoHotkey.exe
IfNotEqual, ErrorLevel, 0
{
{
;Function by Chris
WinGet, List, List, ahk_class AutoHotkey
Loop, %List%
{
ListItem := List%A_Index%
WinGetTitle, Title, ahk_id %ListItem%
StringGetPos, Pos, Title, %A_Space%- AutoHotkey v
if pos < 0 ; Compiled scripts can be left running without harm.
continue ; Skip this script, since it's an EXE.
StringLeft, ScriptFileName, Title, %Pos%
RunScripts = %RunScripts%`n%ScriptFileName%
}
Loop
{
Process, Exist, AutoHotkey.exe
IfEqual, ErrorLevel, 0, Break
Process, Close, AutoHotkey.exe
}
}
}
Loop, %Installer% ; gets the 8.3 short name for the command line
ShortPathName = %A_LoopFileShortPath%
RunWait, %COMSPEC% /C %ShortPathName% /S,,HIDE
Text = AHK %LatestVer% Installed `n...Restoring Settings
TrayTip,AHKLiveUpdate,%Text%,15,1
IfNotEqual, RegCmp,
RegWrite, REG_SZ, HKEY_CLASSES_ROOT, AutoHotkeyScript\Shell\Compile\Command,, %RegCmp%
IfNotEqual, RegEdt,
RegWrite, REG_SZ, HKEY_CLASSES_ROOT, AutoHotkeyScript\Shell\Edit\Command,, %RegEdt%
IfNotEqual, RegOpn,
RegWrite, REG_SZ, HKEY_CLASSES_ROOT, AutoHotkeyScript\Shell\Open\Command,, %RegOpn%
IfNotEqual, RegRun,
RegWrite, REG_SZ, HKEY_CLASSES_ROOT, AutoHotkeyScript\Shell\Run\Command,, %RegRun%
IfNotExist, %AHKPath%\Compiler\AutoHotkeySC.bin
{
%Text% = AutoHotkey BIN is not correctly installed.
TrayTip,AHKLiveUpdate,%Text%,15,1
sleep,1000
ExitApp
}
;creates backup (no overwrite so orig is retained)
FileCopy, %AHKPath%\Compiler\AutoHotkeySC.bin, %AHKPath%\Compiler\AutoHotkeySC.bak
IfNotEqual, MIco,
{
RunWait, %RHPath% -addoverwrite %AHKPath%\Compiler\AutoHotkeySC.bin`, %AHKPath%\Compiler\AutoHotkeySC.bin`, %MIco%`, icon`,159`,
RunWait, %RHPath% -addoverwrite %AHKPath%\Compiler\AutoHotkeySC.bin`, %AHKPath%\Compiler\AutoHotkeySC.bin`, %MIco%`, icon`,228`,
}
IfNotEqual, SIco,
{
RunWait, %RHPath% -addoverwrite %AHKPath%\Compiler\AutoHotkeySC.bin`, %AHKPath%\Compiler\AutoHotkeySC.bin`, %SIco%`, icon`,206`,
RunWait, %RHPath% -addoverwrite %AHKPath%\Compiler\AutoHotkeySC.bin`, %AHKPath%\Compiler\AutoHotkeySC.bin`, %SIco%`, icon`,229`,
}
IfNotEqual, PIco,
RunWait, %RHPath% -addoverwrite %AHKPath%\Compiler\AutoHotkeySC.bin`, %AHKPath%\Compiler\AutoHotkeySC.bin`, %PIco%`, icon`,207`,
IfNotEqual, SPIco,
RunWait, %RHPath% -addoverwrite %AHKPath%\Compiler\AutoHotkeySC.bin`, %AHKPath%\Compiler\AutoHotkeySC.bin`, %SPIco%`, icon`,208`,
IfNotEqual, VRes,
RunWait, %RHPath% -addoverwrite %AHKPath%\Compiler\AutoHotkeySC.bin`, %AHKPath%\Compiler\AutoHotkeySC.bin`, %VRes%`, VersionInfo`,1`,
FileCopy,%STXPath%\AutoHotkey.ctl,%EditSTXPath%\AutoHotkey.ctl,1
FileCopy,%STXPath%\AutoHotkey.stx,%EditSTXPath%\AutoHotkey.stx,1
FileDelete,%A_Programs%\AutoHotkey\Website.lnk
FileDelete,%A_ProgramsCommon%\AutoHotkey\Website.lnk
FileDelete,%A_Programs%\AutoHotkey\AutoHotkey.lnk
FileDelete,%A_ProgramsCommon%\AutoHotkey\AutoHotkey.lnk
;FileDelete,%Installer%
Sort, RunScripts, U
Loop, Parse, RunScripts, `n
{
IfExist, %A_LoopField%, Run, %A_LoopField%,, UseErrorLevel
Text = Restarting %A_LoopField%
TrayTip,AHKLiveUpdate,%Text%,10,1
Sleep,1000
}
Text = AHK %LatestVer% `nSettings Restored!
TrayTip,AHKLiveUpdate,%Text%,15,1
Sleep,3000
ExitApp
EDIT: I've tried other scripts and they also have problems. This error does not happen on AHK 1.0.35.0 or earlier. I think it's related to Loop,%var% not being recognized correctly.
I'm also getting a compiler error when using the compiler from the command line on this script (I don't get it when compiling another script).