Showing posts with label automator. Show all posts
Showing posts with label automator. Show all posts

Monday, August 22, 2011

Setting up your work environment with automator

I frequently find myself having to open the same set of applications in order to work (textmate, terminal with several tabs, browser, etc.). So I figured I'd spend some time figuring out how to automate the process.


  • open automator
  • create a new application
  • find "run shell script" <-- try it with this one first, if it doesn't work, use "run applescript"
  • input the following into the shell scripting area (it's a rather small textarea). Change the settings for your particular set of applications you need to use. For me, I want to open my default browser to my local app, open textmate with my project, open my text file with my ongoing notes, and open several terminal tabs with various commands already entered.


open http://myapp.localhost
open ~/Work/myapp/myapp.tmproj
open ~/Desktop/myapp.rtf

osascript 2>/dev/null << EOF

    tell application "Terminal"
       activate
    end tell
    tell application "system events" to tell process "Terminal" to keystroke "t" using command down
    tell application "system events" to tell process "Terminal" to keystroke "t" using command down
    tell application "system events" to tell process "Terminal" to keystroke "t" using command down
    tell application "Terminal"
        do script with command "cd ~/Work/myapp; rails console" in first tab of first window
        do script with command "cd ~/Work/myapp/log; tail -f development.log" in second tab of first window
        do script with command "cd ~/Work/myapp; su -" in last tab of first window
    end tell
EOF

  • save it and put it in your applications directory (it doesn't matter where you put it, but I figure this is the best place)
  • then drag it to your dock

Wednesday, July 22, 2009

I Heart Automator

Every time I wish there were some way I can automate something in OSX, I find out there is a way, through the nifty scripting utility Automator.

I had a particular problem I wanted to solve, which was to add spotlight comments to multiple items. This way I can do dynamic searching of files based on keywords instead of creating an entire folder hierarchy and having to drill down to get to a specified file.


And here's my Automator plugin in action, accessible right from the finder menu. Slick!



Saturday, March 7, 2009

Automator for OSX

I've begun using a software VPN utility called Hamachi, owned by the guys at logmein (every family IT dude's friend). Alas, there is a slick Windows client, but the OSX one is pure command line. I'm totally fine with that, but I figure "let's see if I can make it all OSeXy". So I created a bash script to execute all the Hamachi commands, and I combined that with some Applescript and OSX's Automator, which is kind of a wysiwig script editor. I could have done it all in bash or Applescript, but I wanted to put my script on the dock and run it from there. Only Automator "executables" can be moved directly to the dock.

Here's a sample from my automator window. Note how cool it looks to have a wysiwig script editor!


So the end result is I have a clickable "thing" on my dock which will start up or quit the OSX Hamachi client. I also added in a Growl notification for fun, which is shown below.