====== CloudAHK Sandbox ====== The CloudAHK code runner sandbox is a service by [[user:geek]] that allows you to run a variety of AutoHotkey code in a simulated Windows environment, and see the results returned by ''MsgBox'' commands. Check out the source code of the service [[https://github.com/G33kDude/CloudAHK/|on Github]]. ===== AutoHotkey v1 ===== MsgBox hi ===== AutoHotkey v2 ===== MsgBox "hi" ===== Converter ===== Attempt to convert AHKv1 syntax to AHKv2 using the [[https://www.autohotkey.com/boards/viewtopic.php?f=6&t=25100|AHK-v2-script-converter]] project. ; Requires AutoHotkey v1.1.26+, and the keyboard hook must be installed. #InstallKeybdHook SendSuppressedKeyUp(key) { DllCall("keybd_event" , "char", GetKeyVK(key) , "char", GetKeySC(key) , "uint", KEYEVENTF_KEYUP := 0x2 , "uptr", KEY_BLOCK_THIS := 0xFFC3D450) } ; Disable Alt+key shortcuts for the IME. ~LAlt::SendSuppressedKeyUp("LAlt") ; Test hotkey: !CapsLock::MsgBox % A_ThisHotkey ; Remap CapsLock to LCtrl in a way compatible with IME. *CapsLock:: Send {Blind}{LCtrl DownR} SendSuppressedKeyUp("LCtrl") return *CapsLock up:: Send {Blind}{LCtrl Up} return ===== Compiler ===== Compile C code to an AHK-compatible loader function. #include MCL_EXPORT(add, Int, a, Int, b, Cdecl_Int); int add(int a, int b) { return a + b; } MCL_EXPORT(sub, Int, a, Int, b, Cdecl_Int); int sub(int a, int b) { return a - b; } MCL_EXPORT(mul, Int, a, Int, b, Cdecl_Int); int mul(int a, int b) { return a * b; }