AHK-EXE-SWapper does not work if AHK is not in C:\Program Files, because it gets wrong AHK path.
It needs to run without using the AHK EXE, as it has to change the AHK exe.
So does anyone have any code to find AHK install folder?
eg find key in registry, or write temp AHK file to extract A_AhkPath from AHK exe?
Obviously I am capable of writing it myself, I just wondered if anyone already has a code snippet that works.
Anyone got code to find the AHK install folder that does NOT use A_AhkPath?
Re: Anyone got code to find the AHK install folder that does NOT use A_AhkPath?
looks like the guy showed the regkey in your mainthread:
Run regedit in my machine, `HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoHotkeyScript\Shell\Open\Command` says "d:\TechnicalSupport\ProgramFiles\AutoHotkey\AutoHotkey.exe" "%1" %*
Re: Anyone got code to find the AHK install folder that does NOT use A_AhkPath?
Is this gonna be x64 / x86 / All OS versions safe?
Code: Select all
RegRead, reg, HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoHotkeyScript\Shell\Open\Command
RegexMatch(reg, "U)\""(.*)\""", reg)
msgbox % reg1
Re: Anyone got code to find the AHK install folder that does NOT use A_AhkPath?
Code: Select all
HKEY_LOCAL_MACHINE\SOFTWARE\AutoHotkey\InstallDir
Re: Anyone got code to find the AHK install folder that does NOT use A_AhkPath?
HKEY_LOCAL_MACHINE\SOFTWARE\AutoHotkey does not exist on my system
Re: Anyone got code to find the AHK install folder that does NOT use A_AhkPath?
mine either (win10)evilC wrote:HKEY_LOCAL_MACHINE\SOFTWARE\AutoHotkey does not exist on my system
but i do have this:
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\AutoHotkey\InstallDir
Re: Anyone got code to find the AHK install folder that does NOT use A_AhkPath?
Code: Select all
RegRead, OutputVar, HKEY_LOCAL_MACHINE\SOFTWARE\AutoHotkey, InstallDir
Re: Anyone got code to find the AHK install folder that does NOT use A_AhkPath?
See Installer.ahk.
Code: Select all
AutoHotkeyKey := "SOFTWARE\AutoHotkey"
;...
; This first section has two purposes:
; 1) Determine the location of any current installation.
; 2) Determine which view of the registry it was installed into
; (only applicable if the OS is 64-bit).
CurrentRegView := ""
Loop % (A_Is64bitOS ? 2 : 1) {
SetRegView % 32*A_Index
RegRead CurrentPath, HKLM, %AutoHotkeyKey%, InstallDir
if !ErrorLevel {
CurrentRegView := A_RegView
break
}
}
Who is online
Users browsing this forum: Google [Bot], william_ahk and 167 guests