roadrunnertwice: A roadrunner *actually running on a road.* (Roadrunner - Going faster miles an hour)
[personal profile] roadrunnertwice
I learned how to talk to Growl today! Hello, Growl.

Context here is that I'm trying to abandon ship on Quicksilver on account of its oldness, staleness, and general decrepitude, but since I used it for such a weird variety of stuff, I'm having to get a little creative on how to replace it. In this case, I'd rigged QS to throw a Growl alert describing the currently playing track in iTunes whenever I whacked a certain hotkey, and since I wasn't interested in running a whole extra app just for that, I figured I could probably roll my own thingamabob and trigger it with FastScripts.

I figured right! And here's the goods:

tell application "iTunes"

set trackName to name of current track

set trackArtist to artist of current track

set trackAlbum to album of current track

set trackRating to rating of current track

if artworks of current track is not {} then

set trackArtwork to the data of artwork 1 of current track

set hasArtwork to true

else

set hasArtwork to false

end if

end tell


tell application "GrowlHelperApp"

(* register as application "iTunes Track Alert" all notifications {"Current Track"} default notifications {"Current Track"} icon of application "iTunes" *)

if hasArtwork is true then

notify with name "Current Track" title trackArtist & " – " & trackName description trackArtist & " – " & trackAlbum & " – " & trackName & " (" & (trackRating / 20 as integer) & ")" application name "iTunes Track Alert" pictImage trackArtwork

else

notify with name "Current Track" title trackArtist & " – " & trackName description trackArtist & " – " & trackAlbum & " – " & trackName & " (" & (trackRating / 20 as integer) & ")" application name "iTunes Track Alert"

end if

end tell



For reasons that are somewhat complicated, you'll have to paste that into AppleScript Editor and save it, then uncomment that one line, run the script a single time, and close the file without saving. After that, it'll work just fine, and you can set the display options for the alert in Growl's preference pane; the name of the application will be "iTunes Track Alert."

(Yes, I could have just left that line uncommented and skipped that extra step, but that seemed to make it run slower when I was testing it, and it really does only have to happen once.)

Incidentally, my hacked-up-in-an-afternoon-bullshit-AppleScript replacement for this feature turns out to be better than Quicksilver's version, because it shows the artwork even when it's not embedded in the file and can display the track's rating. Take that!

(no subject)

Date: 2010-09-12 06:40 pm (UTC)
From: [identity profile] fozwalla.livejournal.com
Crazy. I was wondering just yesterday whether I could find something that would make Growl do exactly this. I've been keeping iTunes on shuffle lately, and sometimes unfamiliar stuff will come on, or I won't recognize the intro, or there's a quiet intro with a buildup, etc.

I might give it a shot later.

(no subject)

Date: 2010-09-13 04:30 am (UTC)
From: [identity profile] fozwalla.livejournal.com
Huh. How can I make it so FastScripts runs the script no matter what app is currently active? Right now accidentally I set it up so it runs only when iTunes is active. Is there a "general" folder? /Library/Scripts? /Users/[me]/Library/Scripts?

(no subject)

Date: 2010-09-13 04:44 am (UTC)
From: [identity profile] fozwalla.livejournal.com
Sweet. This should come in useful. (AHAHA. I had to use it RIGHT after typing that.)

What do you have your keyboard shortcut set to?

(no subject)

Date: 2010-09-13 04:59 am (UTC)
From: [identity profile] fozwalla.livejournal.com
So your Dvorak version of "/" is where "z" is on the Qwerty layout?

I wasn't kidding about wishing for this exact thing yesterday. Literally. I think I saw a Growl notification for something else, and I was like, "It'd be cool to be able to call that to see what iTunes is playing."

(no subject)

Date: 2010-09-13 05:27 am (UTC)
From: [identity profile] fozwalla.livejournal.com
So, not to take the thunder out of your scripting feat, but after installing this, I thought, "What if the current song/artist could be set up to show in the menu bar, since there's so much empty space?" I looked around, found something called QuickTunes that did just that, installed it next to my existing ByteController, and took it for a spin. I read your reply on Dvorak and glanced up to see what had shuffled in...



AAAAHAHAHAHA. Plus, I linked to some of these same songs on your journal a couple weeks ago.

ASDLFKJ FKJAKSJDF LK FKASDASF

Fine, so my collection isn't so big. There's about a 1/100 chance that a song by this guy would come on. But still.

Profile

roadrunnertwice: Vesta Tilley, Victorian drag king (Default)
Nick Eff

May 2017

S M T W T F S
 123456
7 8910111213
14151617181920
21222324252627
28293031   

Expand Cut Tags

No cut tags

Most Popular Tags

Static and Noise

If you pass the rabid child, say "hammer down" for me.

The Fell Types are digitally reproduced by Igino Marini.

Style Credit