topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • Thursday April 18, 2024, 5:48 am
  • 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

Author Topic: ReRun - Run a program repeatedly on hotkey  (Read 6435 times)

justice

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,898
    • View Profile
    • Donate to Member
ReRun - Run a program repeatedly on hotkey
« on: August 03, 2010, 05: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 [Select]
  1. ; Change line 6 to a new hotkey: see http://www.autohotkey.com/docs/Hotkeys.htm#symbols
  2.  
  3. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  4. §::
  5. if program =
  6.         FileSelectFile, program, 3, , Open a file, Programs (*.bat; *.com; *.exe)
  7. if program <>  
  8. {
  9.         SplitPath, program ,, OutDir
  10.         SetWorkingDir %OutDir%
  11.         RunWait, %program%
  12. }
  13. 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
    • View Profile
    • Donate to Member
Re: ReRun - Run a program repeatedly on hotkey
« Reply #1 on: August 03, 2010, 01:51 PM »
Thanks, I can use that.

justice

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,898
    • View Profile
    • Donate to Member
Re: ReRun - Run a program repeatedly on hotkey
« Reply #2 on: August 04, 2010, 03: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
    • View Profile
    • Donate to Member
Re: ReRun - Run a program repeatedly on hotkey
« Reply #3 on: August 04, 2010, 08:26 AM »
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.