Well, creating a U3 Package isn't that hard. I've created one, but I haven't tested it jet (especially writing into registry and deleting OnExit).
DOWNLOAD AHK U3-Package (Right Click, Save Target as...)
The Launcher Code:
Code:
; regAHK
;
SetWorkingDir, %A_ScriptDir%
#NoEnv
#Singleinstance, ignore
If (1 = "/Src") {
FileInstall, regAHK.ahk, regAHK.ahk, 1
ExitApp
}
editr = %1%
OnExit, Cleanup
RegAHKExt()
Menu, Tray, NoStandard
Menu, Tray, Add, AutoHotkey Help File, helpfile
Menu, Tray, Add, AutoIt3 Window Spy, auspy
Menu, Tray, Add, AutoScriptWriter (recorder), record
Menu, Tray, Add
Menu, Tray, Add, AutoHotkey Website (ENG), ahkwseng
Menu, Tray, Add, AutoHotkey Website (DEU), ahkwsdeu
Menu, Tray, Default, AutoHotkey Help File
Return
Cleanup:
check := UnRegAHKExt()
If check {
Sleep, 5000
check := UnRegAHKExt()
}
If check {
Msgbox, 16, ERROR, Some Registrykeys remained. Please delete them manually.
}
ExitApp
Return
helpfile:
Run, %A_Scriptdir%\AuotHotkey.chm
Return
auspy:
Run, %A_Scriptdir%\AU3_Spy.exe
Return
record:
Run, %A_Scriptdir%\AutoScriptWriter\AutoScriptWriter.exe
Return
ahkwseng:
Run, http://www.autohotkey.com
Return
ahkwsdeu:
Run, http://de.autohotkey.com
Return
RegAHKExt(launch=true, edit=true, compile=true) {
global editr
ahkdir := A_ScriptDir
RegWrite, REG_SZ, HKEY_CLASSES_ROOT, .ahk, , AutoHotkeyScript
RegWrite, REG_SZ, HKEY_CLASSES_ROOT, .ahk\ShellNew, FileName, %ahkdir%\Template.ahk
RegWrite, REG_SZ, HKEY_LOCAL_MACHINE, SOFTWARE\AutoHotkey, InstallDir, %ahkdir%
RegWrite, REG_SZ, HKEY_LOCAL_MACHINE, SOFTWARE\AutoHotkey, Version, %A_AHKVersion%
RegWrite, REG_SZ, HKEY_CLASSES_ROOT, AutoHotkeyScript, , AutoHotkey Script
RegWrite, REG_SZ, HKEY_CLASSES_ROOT, AutoHotkeyScript\DefaultIcon, , %ahkdir%\AutoHotkey.exe`,1
RegWrite, REG_SZ, HKEY_CLASSES_ROOT, AutoHotkeyScript\Shell, , Open
openscr := A_Language="0407" ? "Script starten" : "Run Script"
editscr := A_Language="0407" ? "Script editieren" : "Edit Script"
compscr := A_Language="0407" ? "Script kompilieren" : "Compile Script"
If launch {
RegWrite, REG_SZ, HKEY_CLASSES_ROOT, AutoHotkeyScript\Shell\Open, , %openscr%
RegWrite, REG_SZ, HKEY_CLASSES_ROOT, AutoHotkeyScript\Shell\Open\Command, , %ahkdir%\AutoHotkey.exe "`%1"
}
If edit {
editor := !editr ? "notepad.exe" : editr
RegWrite, REG_SZ, HKEY_CLASSES_ROOT, AutoHotkeyScript\Shell\Edit, , %editscr%
RegWrite, REG_SZ, HKEY_CLASSES_ROOT, AutoHotkeyScript\Shell\Edit\Command, , %editor% "`%1"
}
If compile {
RegWrite, REG_SZ, HKEY_CLASSES_ROOT, AutoHotkeyScript\Shell\Compile, , %compscr%
RegWrite, REG_SZ, HKEY_CLASSES_ROOT, AutoHotkeyScript\Shell\Compile\Command, , %ahkdir%\Compiler\Ahk2Exe.exe /in "`%1"
}
Return, 1
}
UnRegAHKExt() {
RegDelete, HKEY_CLASSES_ROOT, AutoHotkeyScript
err += Errorlevel
RegDelete, HKEY_CLASSES_ROOT, .ahk
err += Errorlevel
RegDelete, HKEY_LOCAL_MACHINE, SOFTWARE\AutoHotkey
err += Errorlevel
Return, err=0 ? true : false
}
If there's an issue, just modify the code, recompile it, open the u3p package with winrar, and move the compiled script with the name 'regAHK.exe' into the right folder ('Device').
Cheers
Obi-Wahn
PS.: Please notify my when there are Bugs.
PPS.: This script writes into registry. If there are any damages to the computer or the RegWrite doesn't work because of an lack of User-Rights, I'm not reponsible for.
PPPS.: The Package is tested with virustotal.com. 1 Hit out of 32. eSafe reports a malicious file (maybe upx.exe). I've compiled the script w/o UPX.