Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1.  
  2. ;[Menu options]
  3. Menu = Options:`n1 - [Run/Reload] `n2 - Stop`n3 - Edit`n4 - Save`n5 - Compile|Options:`n1 - Run/Reload `n2 - [Stop]`n3 - Edit`n4 - Save`n5 - Compile|Options:`n1 - Run/Reload `n2 - Stop`n3 - [Edit]`n4 - Save`n5 - Compile|Options:`n1 - Run/Reload `n2 - Stop`n3 - Edit`n4 - [Save]`n5 - Compile|Options:`n1 - Run/Reload `n2 - Stop`n3 - Edit`n4 - Save`n5 - [Compile]
  4. MenuOptions = Run/Reload|Stop|Edit|Save|Compile
  5.  
  6. StringSplit, Menu, Menu, |
  7. StringSplit, MenuOptions, MenuOptions, |
  8.  
  9. RegRead, AutoHotkeyDir, HKEY_LOCAL_MACHINE, SOFTWARE\AutoHotkey, InstallDir
  10.  
  11. ;[Assigning keyboard hotkeys]
  12. Loop, 4
  13. Hotkey, % Chr(A_Index+48), KeyDown
  14. ;[/Assigning keyboard hotkeys]
  15.  
  16. Return
  17. ::execute::
  18. ^R::
  19. ClipboardOld := Clipboard
  20. Send ^c
  21. Script := Clipboard
  22. Clipboard := ClipboardOld
  23. ToolTip, %Menu1%
  24.  
  25. Return
  26. KeyDown:
  27. StringRight, KeyPressed, A_ThisHotKey, 1
  28. ToolTip, % Menu%KeyPressed%
  29.  
  30. Return
  31. Enter::
  32. ToolTip, % "Option " MenuOptions%KeyPressed% " is selected"
  33. Goto, % MenuOptions%KeyPressed%
  34.  
  35. Return
  36. Run/Reload:
  37. FileDelete, AutoHotkeyTempScript.ahk
  38. FileAppend, %Script%, %A_Temp%AutoHotkeyTempScript.ahk
  39. Process, Exist, AutoHotkey.exe
  40. If (ErrorLevel <> 0){
  41. TrayTip, Reloading...,, 1, 1
  42. Process, Close, AutoHotkey.exe
  43. Run, %A_Temp%AutoHotkeyTempScript.ahk
  44. }
  45. Else {
  46. TrayTip, Executing...,, 1, 1
  47. Run, %A_Temp%AutoHotkeyTempScript.ahk
  48. }
  49.  
  50. Return
  51. Stop:
  52. Process, Exist, AutoHotkey.exe
  53. If (ErrorLevel <> 0){
  54. TrayTip, Stopping...,, 1, 1
  55. Process, Close, AutoHotkey.exe
  56. }
  57. Else
  58. TrayTip, Script already stopped...,, 1, 1
  59.  
  60. Return
  61. Edit:
  62. Run, notepad.exe, %A_Temp%AutoHotkeyTempScript.ahk
  63.  
  64. Return
  65. Save:
  66. FileSelectFolder, Folder, *%A_MyDocuments%, 4, Please select a directory to save script
  67. IfExist, %Folder%\Script.ahk
  68. {
  69. MsgBox, 36, Overwrite File?, '%Folder%\Script.ahk' already exists`, overwrite file?
  70. IfMsgBox, No
  71. Return
  72. Else
  73. FileDelete, %Folder%\Script.ahk
  74. }
  75. FileAppend, %Folder%\Script.ahk
  76.  
  77. Return
  78. Compile:
  79. MsgBox, sorry i haven't wrote this aprt yet`, there is two options`, either make a gui yourself or use a compiler made by rajat i think
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement