Good idea! I think I’ll use a script like this, too. I am always switching to iTunes just to see what song is playing…
actually…
set trackInfo to "unknown"
tell application "iTunes"
if (class of current track is URL track) then
set trackInfo to current stream title
else
set trackInfo to (artist of current track as string) & " - " & (name of current track as string)
end if
end tell
display dialog trackInfo buttons {"OK"} default button "OK"
I’m using the script I asked for in a DragThing Dock of all things.
The iTunes icon is the script I asked for. Clicking it hides or shows iTunes. It’s very convenient. The other docks control simple scripts “Previous Track”, “Playpause” and “Next Track” of course.
@Redsweater, that script may come in handy when I add a “dock” for the title of the song.
The way I see it, why run a bloated Konfabulator when a DragThing Dock can do the same thing with less overhead? Sure, it ain’t as fancy, but it is functional and it looks as good as you want it to look.
DragThing will run AppleScripts from within the app if you save them as the default AppleScript document type. So basically, you can make script after script perform tedious actions and have them all in docks. I also made a “Cleanup the Desktop” script yesterday. Then you just assign a keypress to the script and viola! You are fully automated. I <3 AppleScript.
I just installed it and tried it out. It’s pretty good. It’s still not good enough for me to close up shop on FastScrips, since it’s really slow at running the Script, and doesn’t do any elegant integration with the front-most app like FS does.
I have been surprised that more hotkey enabled apps don’t make their AppleScript execution experience better. I keep waiting for one of them to give FS a real run for the money, but they always lack something important. (to me, anyway! )
Nice !
Now download QuickSilver from versiontracker (free).
Change the last line of code to:
tell application "Quicksilver" to show large type trackInfo
And you get beautifull bezel large type !
(With QS you can also make mouse triggers, keyboard triggers and open apps / docs/ urls with keyboard abbreviations; combines very well with Applescript)
Why?
At least using FastScripts, I see the same behaviour. When I’m working in Safari, I can see and execute Safari specific scripts (plus my user-defined “universal” or system-wide scripts). And also the super-cool feature of invoking them using keystrokes, being executed almost immediately, using “path to me” in a real fashion, etc. :rolleyes:
One thing I am thinking about adding to FastScripts is some kind of “tear-off menu” idea so you could turn the menu or any submenu into a floating window. I can see some use for having easy mouse access to a bunch of scripts from a given category.
I use DT because I can get creative and make a nice interface for them. I do not want to have to dig through menus! If I liked menus, why would I need DragThing? I could just have one big menu… like the Windows Start Menu. But I’d rather have it all at my fingertips. Also, I already purchased the uberuseful DragThing, I don’t want to have to buy another app when DT can do the same thing.
I don’t mind the delay. I notice no delay in the iTunes Dock though. It’s only one line of code (Aside from the “Tell Application “Safari”” part.) so it’s fast acting.
Besides, my buttons look oh so cool when they have the shadow on.
Okay, now. I need to extend my script. How can I tell if iTunes is the frontmost app? The script works great until another app becomes frontmost, then it only hides and shows behind the other apps. So I need to be able to tell if it’s at the front and if not, then bring it front.
Then, just bring iTunes allways to the front (if it isn’t the frontmost, it will become the frontmost; if it is the frontmost, it will remain the frontmost):
I tried that, but something was going wrong. It kept freaking out. iTunes would hide, THEN come forward and show again. Even though the “Bring Forward” part was before the Hide part.
I fixed it with some If…Then…Else stuff. Works perfect now.
tell application "System Events"
if exists process "iTunes" then
if visible of process "iTunes" is not true then
set visible of process "iTunes" to true
set the frontmost of application process "iTunes" to true
else
set visible of process "iTunes" to false
end if
else
tell application "iTunes" to activate
end if
end tell
Basically, it also launches iTunes if it’s not running already whereas before it would cause errors.