How do I perform a key combination every 10 minutes?

Discussion in 'macOS' started by elitesouth, May 7, 2010.

  1. elitesouth macrumors member


    Nov 24, 2009
    Savannah GA
    There's an application that I use that performs a command whenever I type CTRL+1 no matter which application I'm in.

    When I'm away, I'd like to have OS X perform that key combo every 10 minutes. How is this accomplished?

    Thanks in advance for your help.
  2. zeemeerman2 macrumors 6502

    Feb 21, 2010
    Dunno. Maybe try AppleScript to make a script of it?
  3. elitesouth thread starter macrumors member


    Nov 24, 2009
    Savannah GA
    Yeah that's what I've seen around the web (don't think I haven't googled it already), but I was looking for more of a direction in which to go on how to set up this Applescript, Automator, etc.
  4. Hal Itosis macrumors 6502a

    Hal Itosis

    Feb 20, 2010
    Probably learning about launchd would be worthwhile (start with man launchd.plist).

    What is this periodic command then?
  5. andmr macrumors member

    Aug 25, 2008
    NE Florida
    In addition, you might try the script below. Copy the code and paste it into your AppleScript Editor. Replace "app_name" with the name of the application you desire to be frontmost at runtime. From the Script Editor's File menu select Save As > File Format: application, and be sure to check "Stay Open" under Options.

    The script:

    on idle
    tell application "app_name" to activate -- replace "app_name" with frontmost app
    tell application "System Events"
    key code 18 using control down
    end tell
    return 600 -- repeats in ten minutes
    end idle

    Launch the script prior to leaving your computer, as needed. To quit the script at any time while it's running, click on its docked icon and select Quit from the popup menu. Hope this helps.
  6. fhall1 macrumors 68040


    Dec 18, 2007
    (Central) NY State of mind
    The folks on "Lost" could've used a script like that a few seasons ago. :)

Share This Page