topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday July 31, 2025, 8:44 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Boyce [ switch to compact view ]

Pages: [1]
1
Finished Programs / ReRun - Run a program repeatedly on hotkey
« on: July 23, 2021, 12:13 AM »
When a certain hotkey is pressed, ReRun asks you for a program and runs it. From then on, everytime this hotkey is pressed, the program is run again.

This is useful if you working to improve a script/ ahk file / batch file and need to test it repeatedly, or are needing to manually compile/deploy/run commands repeatedly. Using rerun is faster than finding the active window and clicking on a program to launch it.

Code: C++ [Select]
  1. ; Change line 6 to a new hotkey: see http://www.autohotkey.com/docs/Hotkeys.htm#symbols
  2.  
  3. #NoEnv
  4. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  5. §::
  6. if program =
  7.         FileSelectFile, program, 3, , Open a file, Programs (*.bat; *.com; *.exe)
  8. if program <>  
  9. {
  10.         SplitPath, program ,, OutDir
  11.         SetWorkingDir %OutDir%
  12.         RunWait, %program%
  13. }
  14. return

Note: the default hotkey is §, which is handy if you have a mac uk keyboard, but annoying if you don't. So change the start of line 5.

Mod Note: though the poster turned out to be a spammer, the script might be of use to someone.

Pages: [1]