HOW IT WORKS:
Install AHK_L or AHKBasic to a separate Program Files directory so you have 2 versions on 1 system.
The other version MUST BE INSTALLED IN PROGRAM FILES!
When you run the script, it will replace one version with the other.
No longer touches the AHK's executable.
#SingleInstance ignore
RegRead, poVal, HKCR, \AutoHotkeyScript\Shell\Open\Command
If !poVal {
MsgBox, 0x10, Error!, Cannot find AutoHotkey.exe`nThis script will now exit.
ExitApp
}
MsgBox, 0x4, AHK Switcher, % "You are running AHK " (v:=A_AhkVersion) "`n"
. "Switch to AHK_" ( shNm := ( InStr( v, "1.1." ) ? "Basic" : "L" ) ) "?"
IfMsgbox No
ExitApp
RegExMatch( A_AhkPath, "\\\K\w+\.\w+", aNme )
Loop, % A_ProgramFiles "\*.*", 0, 1
If RegExMatch( A_LoopFileFullPath, aNme ) {
FileGetVersion, aVer, % swDir := A_LoopFileFullPath
If ( RegExReplace( aVer, 0 ) <> RegExReplace( A_AhkVersion, 0 ) ) {
swDir := """" RegExReplace( swDir, ".*\\\K.*" ), fnd:=!fnd
Break
}
}
If !fnd {
Msgbox, 0x30, Switch Stopped!, % "AutoHotKey " A_AhkVersion " was the only version found!`n"
. "Please install AHK_" shNm " in a separate Program Files Directory."
ExitApp
}
cmp = Compiler\Ahk2Exe.exe`" /in `"`%l`"
cmpVal := swDir . cmp
opnVal := swDir . aNme """ "`"`%1`"" `%*"
Loop 2
RegWrite, REG_SZ, HKCR, % "AutoHotkeyScript\Shell\" ( (i:=!i) ? "Compile" : "Open" ) "\Command",, % ( i ? cmpVal : opnVal )
TrayTip, Versions Switched!, % "Successfully switched to AHK_" shNm "!",, 1
WinWaitClose, ahk_class tooltips_class32
ExitAppI've tested this successfully on WIN764/32 and XP32.It can take long find the switch version if only 1 instance of AHK is installed.
This is because it searches the Program Files folder recursively.
To address this, I may add a search display with a cancel button.




