Advertisement
Faecous

AHK macro maker

May 16th, 2023
1,752
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; This is an AHK script.
  2. Gui, MacroMaker:New, , Macro Maker
  3. Gui, Add, Text, x10 y10, Trigger Key
  4. Gui, Add, Edit, x100 y10 w100 vTriggerKey
  5. Gui, Add, Checkbox, x210 y10 vShift, Shift
  6. Gui, Add, Checkbox, x260 y10 vCtrl, Ctrl
  7. Gui, Add, Checkbox, x310 y10 vAlt, Alt
  8. Gui, Add, Checkbox, x360 y10 vWin, Win
  9. Gui, Add, Text, x10 y40, Key State
  10. Gui, Add, DropDownList, x100 y40 w100 vKeyState, Down|Up
  11. Gui, Add, Text, x10 y70, Time in State (ms)
  12. Gui, Add, Edit, x100 y70 w100 vTimeInState
  13. Gui, Add, Text, x10 y100, Time Between Actions (ms)
  14. Gui, Add, Edit, x100 y100 w100 vTimeBetweenActions
  15. Gui, Add, Button, x10 y130 w100 gSubmit, Submit
  16. Gui, Show, , Macro Maker
  17. return
  18.  
  19. Submit:
  20. Gui, Submit, NoHide
  21. ; Here we will process the user input
  22. return
  23. Gui, Add, Text, x10 y160, Clipboard Manipulation
  24. Gui, Add, DropDownList, x100 y160 w100 vClipboardManipulation, None|Copy|Paste|Cut
  25. Gui, Add, Text, x10 y190, Text Input
  26. Gui, Add, Edit, x100 y190 w200 vTextInput
  27. Gui, Add, Button, x10 y220 w100 gSubmit, Submit
  28. Gui, Show, , Macro Maker
  29. return
  30. Submit:
  31. Gui, Submit, NoHide
  32. MsgBox, You entered:`nTrigger Key: %TriggerKey%`nKey State: %KeyState%`nTime in State: %TimeInState%`nTime Between Actions: %TimeBetweenActions%`nClipboard Manipulation: %ClipboardManipulation%`nText Input: %TextInput%
  33. return
  34. Submit:
  35. Gui, Submit, NoHide
  36. FileDelete, %A_Desktop%\Macro.ahk
  37. KeyState := (KeyState = "Down") ? "" : " Up"
  38. FileAppend,
  39. (
  40. ^%TriggerKey%%KeyState%::
  41. ...
  42. ), %A_Desktop%\Macro.ahk
  43. MsgBox, Macro created on your desktop.
  44. return
  45. Submit:
  46. Gui, Submit, NoHide
  47. FileDelete, %A_Desktop%\Macro.ahk
  48. KeyState := (KeyState = "Down") ? "" : " Up"
  49. FileAppend,
  50. (
  51. ^%TriggerKey%%KeyState%::
  52. Sleep, %TimeInState%
  53. ...
  54. Sleep, %TimeBetweenActions%
  55. ), %A_Desktop%\Macro.ahk
  56. MsgBox, Macro created on your desktop.
  57. return
  58. Submit:
  59. Gui, Submit, NoHide
  60. FileDelete, %A_Desktop%\Macro.ahk
  61. KeyState := (KeyState = "Down") ? "" : " Up"
  62. FileAppend,
  63. (
  64. ^%TriggerKey%%KeyState%::
  65. Sleep, %TimeInState%
  66. if (ClipboardManipulation = "Copy")
  67.     Send, ^c
  68. else if (ClipboardManipulation = "Paste")
  69.     Send, ^v
  70. else if (ClipboardManipulation = "Cut")
  71.     Send, ^x
  72. Send, %TextInput%
  73. Sleep, %TimeBetweenActions%
  74. ), %A_Desktop%\Macro.ahk
  75. MsgBox, Macro created on your desktop.
  76. return
  77. Submit:
  78. Gui, Submit, NoHide
  79. FileDelete, %A_Desktop%\Macro.ahk
  80. KeyState := (KeyState = "Down") ? "" : " Up"
  81. FileAppend,
  82. (
  83. ^%TriggerKey%%KeyState%::
  84. Sleep, %TimeInState%
  85. if (Shift = 1 and GetKeyState("Shift", "P"))
  86.     Send, +%TriggerKey%
  87. if (Ctrl = 1 and GetKeyState("Ctrl", "P"))
  88.     Send, ^%TriggerKey%
  89. if (Alt = 1 and GetKeyState("Alt", "P"))
  90.     Send, !%TriggerKey%
  91. if (Win = 1 and GetKeyState("Win", "P"))
  92.     Send, #%TriggerKey%
  93. if (ClipboardManipulation = "Copy")
  94.     Send, ^c
  95. else if (ClipboardManipulation = "Paste")
  96.     Send, ^v
  97. else if (ClipboardManipulation = "Cut")
  98.     Send, ^x
  99. Send, %TextInput%
  100. Sleep, %TimeBetweenActions%
  101. ), %A_Desktop%\Macro.ahk
  102. MsgBox, Macro created on your desktop.
  103. return
  104.  
  105.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement