New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Operating System General OS operation information and support

OS 10.5 - need help to amend a script so that it only runs if iTunes is running


Post Reply New Thread Subscribe

 
Thread Tools
nick_harambee

 
Member Since: Feb 24, 2007
Posts: 100
nick_harambee is on a distinguished road

nick_harambee is offline
hi

i have been using a script developed by someone else and posted online which uses geektool in combination with a script to display information about the currently playing track in iTunes in the menu bar. everything works fine, but there is one problem, namely that in order to get accurate information from iTunes (including the percentage of the track that has been played), i have set the refresh rate to 1 second, which means that each time I try to restart my Mac I have to disable geektool before I can do so, because if I don't geektool will relaunch iTunes one second after it has quit, and this cancels the restart.

I would like to not have to disable and then enable geektool each time i restart my mac, and wonder if there is anything I can do, such as amending the script to only run if iTunes is running, so that I don't have to do disable/enable geektool. I have very little experience with scripting. Here is the script I am currently running:

tell application "iTunes"
-- This script extracts information about the track currently running in iTunes, and then
-- formats it for one-line display (e.g., using GeekTool).
-- See macosxhints.com - iTunes, the menu bar, unicode, and GeekTool for a
-- detailed description of a similar script that gave me the idea for this one.

-- this spacer determines how many spaces are between some of the items in the display:
set spacer to " "

-- get some simple information and add spaces and punctuation:
set myName to name of current track
set myArtist to spacer & "< " & artist of current track & " >"
set myYear to spacer & "< " & year of current track & " >"

-- if the track is in an album, then put a dash before the album name (to separate
-- it from the information that will be printed before the album):
set myAlbum to album of current track
if myAlbum is not "" then
set myAlbum to spacer & myAlbum
end if

-- get the current position of the track and calculate how far through
-- the track we are, as a percentage:
set myPosition to player position
set myDuration to duration of current track
set myPercent to spacer & (round (myPosition / myDuration * 100)) & "%"

-- this final line determines which pieces of information are displayed:
set output to myName & myArtist & myAlbum & myYear & myPercent
end tell

thanks

nick

OS X 10.5.7
Mac Pro
2 x 3 GHz Dual-Core Intel Xeon
8 GB RAM
QUOTE Thanks
nick_harambee

 
Member Since: Feb 24, 2007
Posts: 100
nick_harambee is on a distinguished road

nick_harambee is offline
putting this one line before the script worked:

tell application "System Events" to if not (process "iTunes" exists) then return

OS X 10.5.7
Mac Pro
2 x 3 GHz Dual-Core Intel Xeon
8 GB RAM
QUOTE Thanks

Post Reply New Thread Subscribe


« Low system memory :( | browser and video player keep resetting to safari and quicktime »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
iTunes library on external HD only. Starting from scratch Doug b OS X - Apps and Games 5 09-12-2008 11:51 AM
iTunes is setting its own burn speeds... help! Manny Pantz iPod Hardware and Accessories 4 03-15-2007 02:41 AM
problems w/ itunes and acquisition running simultaneously? The Lobe Switcher Hangout 2 02-23-2007 10:32 AM
How I moved my iTunes library from PC to Mac llarrea iPod Hardware and Accessories 12 01-21-2007 06:22 PM
Script for iTunes jdgti iPod Hardware and Accessories 1 11-16-2006 07:22 PM

All times are GMT -4. The time now is 11:04 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?