Show / Hide Window

by Martin on 6/08/2008

I’ve been using Yojimbo, for a long while now but Eystein has been pestering me to give Evernote a shot. Common for both of these is that you don’t want to spend any time when you’re dropping stuff into them. I want one key that’ll toggle the visibility of the app. I want to hit my hotkey, dump stuff in, hit my hotkey again and continue what I was doing. Of course, neither of these apps come with that functionality (Well. Yojimbo does come with a “Quick input”-window, but for some reason I never got to loving it.) so here’s an AppleScript to fix that.

Just change the name in the script to whatever app you want to target, create a Quicksilver trigger for it and Bob’s your uncle.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
on run
  tell application "Finder" to set en to name of first ¬
                        process whose frontmost is true
  if en = "Evernote" then
    tell application "System Events" to set visible ¬
                of process "Evernote" to false
    set notHidden to false
  else
    tell application "System Events" to set visible ¬
                of process "Evernote" to true
    activate application "Evernote"
    set notHidden to true
  end if
end run

I’m really enjoying messing around with AppleScript these last few days. For such a light-weight language the benefits of it commanding the OS are huge.

No comments yet.

Write a comment: