DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: ReRun - Run a program repeatedly on hotkey  (Read 9,193 times)

justice

  • Solve issues simply.
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,898
    • Participated in NANY Challenge Four Times
    • Cody Award
    • Coding Snacks
    • DJ Badge - DJ
ReRun - Run a program repeatedly on hotkey
« on: August 03, 2010, 10:19 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: (autohotkey)
; Change line 6 to a new hotkey: see http://www.autohotkey.com/docs/Hotkeys.htm#symbols

#NoEnv 
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
§::
if program =
	FileSelectFile, program, 3, , Open a file, Programs (*.bat; *.com; *.exe)
if program <>  
{
	SplitPath, program ,, OutDir
	SetWorkingDir %OutDir% 
	RunWait, %program%
}
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.

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,776
    • Cody Award
    • Official Forum Clown
    • rotten turkey sandwich - Rotten Turkey Sandwich
Re: ReRun - Run a program repeatedly on hotkey
« Reply #1 on: August 03, 2010, 06:51 PM »
Thanks, I can use that.
Chris

justice

  • Solve issues simply.
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,898
    • Participated in NANY Challenge Four Times
    • Cody Award
    • Coding Snacks
    • DJ Badge - DJ
Re: ReRun - Run a program repeatedly on hotkey
« Reply #2 on: August 04, 2010, 08:53 AM »
No problem, it's one of these programs that is not apparently useful until you're in the situation where you have to constantly check something, like website design (use rerun in combination with Frep to replace certain variables and FtpSync to upload the files to your website with the press of a key.

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • Coding Snacks
    • Volunteers/Staff
    • Gathering Badge
    • Participated in NANY Challenge Once
    • Linux User
Re: ReRun - Run a program repeatedly on hotkey
« Reply #3 on: August 04, 2010, 01:26 PM »
thanks justice..  :up: a situation just arose for this tool as i'm writing a batch file to update some files from the internet to local host.

Original address: https://www.donationcoder.com/forum/index.php?topic=23624.0