User Name
Password
AppleNova Forums » Programmer's Nook »

GeekTool iTunes script


Register Members List Calendar Search FAQ Posting Guidelines
GeekTool iTunes script
Thread Tools
Lucid
Member
 
Join Date: Oct 2009
Location: My Head
 
2009-10-12, 15:41

Hi, I had a few bash lines in GeekTool that displayed the information of the current song playing in iTunes (using osascript), but I accidentally deleted them in some way. Although I'm a C++/Java programmer, I'm not all too familiar with AppleScript, and so I can't get the line of code working again. I swear it was something like the following, and then just inserting "name," "artist," or "album" in the blank, but I can't get it to work.

Code:
osascript -e 'tell application "iTunes" if player state is playing then _____ of current track'
If anybody could shed some light on the situation, it'd be much appreciated.
  quote
chucker
 
Join Date: May 2004
Location: near Bremen, Germany
Send a message via ICQ to chucker Send a message via AIM to chucker Send a message via MSN to chucker Send a message via Yahoo to chucker Send a message via Skype™ to chucker 
2009-10-12, 19:55

Code:
osascript -e 'tell application "iTunes" to if player state is playing then get name of current track'
  quote
chucker
 
Join Date: May 2004
Location: near Bremen, Germany
Send a message via ICQ to chucker Send a message via AIM to chucker Send a message via MSN to chucker Send a message via Yahoo to chucker Send a message via Skype™ to chucker 
2009-10-12, 19:57

You were missing a 'to' and a 'get'. The 'get' is probably obvious; the 'to' is easy enough to explain. You can either have a tell block, like so:

Code:
tell application "iTunes" pause play end tell
Or, you can have a single command:

Code:
tell application "iTunes" to pause
  quote
Lucid
Member
 
Join Date: Oct 2009
Location: My Head
 
2009-10-12, 20:06

Ohhh, I see now. I realized I was missing somewhere where the 'get' is, but I was trying things like output and return, and the 'to' does make sense. Well, at least I gained something out of this. Thanks for the help.
  quote
Posting Rules Navigation
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Post Reply

Forum Jump
Thread Tools
Similar Threads
Thread Thread Starter Forum Replies Last Post
iTunes tags script feidhlim1986 Genius Bar 0 2008-10-15 20:33
Make script launch when iTunes opens? kieran Genius Bar 1 2007-08-01 15:40
Script Menu in iTunes AWOL Engine Joe Genius Bar 3 2006-06-07 06:19
iTunes Album Artwork Program/Script Meltedbutter421 Third-Party Products 2 2005-08-04 08:21
Script? Malware? BarracksSi Genius Bar 7 2005-08-03 21:16


« Previous Thread | Next Thread »

All times are GMT -5. The time now is 06:09.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004 - 2024, AppleNova