Skip to content

Instantly share code, notes, and snippets.

@nimdahk
Created April 10, 2012 00:26
Show Gist options
  • Save nimdahk/2347586 to your computer and use it in GitHub Desktop.
Save nimdahk/2347586 to your computer and use it in GitHub Desktop.
HotkeySet() in AutoHotkey for use by AU3 to AHK_L converters
HotkeySet(Hotkey, FunctionName=""){
Global HotkeySet := Object()
if !FunctionName
{
Try Hotkey, %Hotkey%, Off
return 1 ; Not specified in docs, and hell if I'm installing AU3
}
Try Hotkey, %Hotkey%, HotkeySet, On
catch
return 0 ; failure
if !IsFunc(functionName)
return 0
HotkeySet[Hotkey] := FunctionName
return 1
HotkeySet:
f := HotkeySet[A_ThisHotkey]
%f%()
return
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment