Skip to content

Instantly share code, notes, and snippets.

@jgarber623
Created June 18, 2010 03:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgarber623/443192 to your computer and use it in GitHub Desktop.
Save jgarber623/443192 to your computer and use it in GitHub Desktop.
A simple AppleScript to launch Last.fm.app and hide its window
-- A simple AppleScript to launch Last.fm.app and hide its window
tell application "Last.fm" to activate
tell application "System Events" to keystroke "w" using command down
tell application "Finder" to activate
@jgarber623
Copy link
Author

Activate and close Last.fm.app

I love Last.fm's native OS X app and I prefer to launch it at login. The trouble is the app doesn't respect OS X's "hide" option in Login Items.

Requirements

Usage

Open up this AppleScript in the AppleScript Editor and save it as an application. Add the resulting application to your Login Items and you're off to the races!

For an even slicker experience, try the following:

  1. Right-click on your saved application file and choose "Show Package Contents."
  2. Navigate into the Contents folder.
  3. Double-click Info.plist or right-click and "Open with..." the Property List Editor application.
  4. Under "Information Property List," add a new child/key.
  5. Select "Application is background only" from the dropdown and check the box to the right.
  6. Save and close Info.plist.

Your application should now run without showing up in the Dock. Last.fm.app will now launch and happily hide itself away on login!

@alexreg
Copy link

alexreg commented Jan 3, 2013

Nice little script, this is. Thank you very much! It's a shame that the Last.fm app ignores several big Apple/Mac design guidelines and conventions (this isn't the only one), but this is a handy workaround nonetheless.

@afreeorange
Copy link

Delightful. Thank you!

@bryankennedy
Copy link

Thanks! This worked for me, but wasn't consistent until I added a short wait to the AppleScript at the top of the file before the tells.

delay 5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment