cloudahk

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
cloudahk [2023-07-15 12:38] – ↷ Page moved from playground:cloudahk to cloudahk geekcloudahk [2024-02-08 02:01] (current) – Add compiler section geek
Line 1: Line 1:
-====== CloudAHK Tester ====== +====== CloudAHK Sandbox ====== 
-<accordion> + 
-<panel title="v1"> +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. 
-<runner>MsgBox hi</runner> + 
-</panel> +Check out the source code of the service [[https://github.com/G33kDude/CloudAHK/|on Github]]. 
-<panel title="v2"> + 
-<runner ahk2>;v2 +===== AutoHotkey v1 ===== 
-msgbox "hi"</runner> + 
-</panel+<runner> 
-</accordion>+MsgBox hi 
 +</runner> 
 + 
 +===== AutoHotkey v2 ===== 
 + 
 +<runner ahk2> 
 +MsgBox "hi" 
 +</runner> 
 + 
 + 
 +===== 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. 
 + 
 +<converter> 
 +; 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 
 +</converter> 
 + 
 +===== Compiler ===== 
 + 
 +Compile C code to an AHK-compatible loader function. 
 + 
 +<compiler> 
 +#include <mcl.h> 
 + 
 +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; 
 +} 
 +</compiler>