Advertisement
Najeebsk

CMD-RUN.ahk

Jul 8th, 2022
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; <COMPILER: v1.1.32.00>
  2. #SingleInstance Force
  3. ;SetworkingDir, %A_ScriptDir%
  4. ::mspaint::
  5. Output := RunWaitMany("
  6. (
  7. Start mspaint.exe
  8. )")
  9. return
  10. ::youtube::
  11. Output := RunWaitMany("
  12. (
  13. Start www.youtube.com
  14. )")
  15. return
  16. ::hide::
  17. Output := RunWaitMany("
  18. (
  19. ATTRIB +H +S %CD%
  20. )")
  21. return
  22. ::unhide::
  23. Output := RunWaitMany("
  24. (
  25. ATTRIB -H -S %CD%
  26. )")
  27. return
  28. RunWaitMany(commands) {
  29.     shell := ComObjCreate("WScript.Shell")
  30.     ; Open cmd.exe with echoing of commands disabled
  31.     exec := shell.Exec(ComSpec " /Q /K echo off")
  32.     ; Send the commands to execute, separated by newline
  33.     exec.StdIn.WriteLine(commands "`nexit")  ; Always exit at the end!
  34.     ; Read and return the output of all commands
  35.     return exec.StdOut.ReadAll()
  36. }
  37. #R::Reload
  38. #S::Suspend
  39. #P::Pause
  40. ESC::ExitApp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement