Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 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. ^R::
  18. ClipboardOld := Clipboard
  19. Send ^c
  20. Script := Clipboard
  21. Clipboard := ClipboardOld
  22. KeyPressed = 1
  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. Gosub, % MenuOptions%KeyPressed%
  34.  
  35. Return
  36. Run/Reload:
  37. FileAppend, %Script%, %A_Temp%\AutoHotkeyTempScript.ahk
  38. Process, Exist, AutoHotkey.exe
  39. If (ErrorLevel <> 0){
  40. TrayTip, Reloading...,, 1, 1
  41. Process, Close, AutoHotkey.exe
  42. Run, %A_Temp%AutoHotkeyTempScript.ahk
  43. }
  44. Else {
  45. TrayTip, Executing...,, 1, 1
  46. Run, %A_Temp%AutoHotkeyTempScript.ahk
  47. }
  48.  
  49. Return
  50. Stop:
  51. Process, Exist, AutoHotkey.exe
  52. If (ErrorLevel <> 0){
  53. TrayTip, Stopping...,, 1, 1
  54. Process, Close, AutoHotkey.exe
  55. }
  56. Else
  57. TrayTip, Script already stopped...,, 1, 1
  58.  
  59. Return
  60. Edit:
  61. Run, notepad.exe, %A_Temp%AutoHotkeyTempScript.ahk
  62.  
  63. Return
  64. Save:
  65. FileSelectFolder, Folder, *%A_MyDocuments%, 4, Please select a directory to save script
  66. IfExist, %Folder%\Script.ahk
  67. {
  68. MsgBox, 36, Overwrite File?, '%Folder%\Script.ahk' already exists`, overwrite file?
  69. IfMsgBox, No
  70. Return
  71. Else
  72. FileDelete, %Folder%\Script.ahk
  73. }
  74. FileAppend, %Folder%\Script.ahk
  75.  
  76. Return
  77. Compile:
  78. 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