automate opening a document

Discussion in 'macOS' started by tsd57, Nov 24, 2010.

  1. tsd57 macrumors newbie

    Joined:
    Jun 29, 2007
    #1
    I'm not familiar with how to use Automator, Here's what I want to do:

    How can I open a specific Microsoft Excel document just by pressing a function key or some combination of keys? I'd like to be able to do this from any program.
     
  2. dissolve macrumors 6502a

    Joined:
    Aug 23, 2009
    #2
    Here's what I would do:

    1) Create a new Service in Automator
    2) At the top, select "no input" in "any application" from drop down menu
    3) Search for "script" in the Library pane and drag over "Run Applescript"
    4) Pase the following code in the box:

    Code:
    on run {input, parameters}
    	do shell script("open PATH_TO_FILE")
    end run
    5) Replace PATH_TO_FILE with the path to your excel file
    6) Save it in ~/Library/Services (~ is whatever your Home folder is called)
    7) Go to Keyboard pane in System Preferences
    8) Click on "Keyboard Shortcuts", select "Services" on the left, find the service you just made, hit Enter and type in the shortcut you want

    That should be it. Post back if you have any issues. Hopefully that works.
     
  3. tsd57 thread starter macrumors newbie

    Joined:
    Jun 29, 2007
    #3
    Wow, thanks, this is exactly what I needed. Pretty simple, but it seems like its not made very obvious for most people to program without previous knowledge of automator. Thanks again!
     
  4. dissolve macrumors 6502a

    Joined:
    Aug 23, 2009
    #4
    You're welcome :)

    You are right, that doesn't seem very obvious. That made me go back and look at Automator and I just realized that Excel (at least in the current version) provides an action to "Open Excel Workbooks". I haven't messed with it too much, but this is more in tune with the ideology of Automator. I just think shell scripts are easier :p
     

Share This Page