Geektoo/Apple Script umschreiben (Kann das jemand??? Bitte antworten... Danke!)

B

blue vision

Aktives Mitglied
Thread Starter
Dabei seit
13.08.2011
Beiträge
138
Reaktionspunkte
3
Hallo MacUser, ich habe grad ein Apple-Script für Geektool im Netz gefunden was ich so nicht verwenden möchte. Kann das jemand ändern, bzw. mir erklären was ich machen muss?
Ich hätte gern aus dem Script gerne nur die Titeldauer welche abgelaufen ist angezeigt.

Hier das Script:

-- A nice applescript for displaying what's playing in iTunes as follows:

-- Song by Artist on Album
-- (# Stars) 00:00/00:00 # of #

-- You can use the script for whatever you want, I'd recommend using Geektool.
-- Applescript by Andrew Harrison • andrew@harrison.org • andrew.harrison.org
-- with some parts from Doug's Applescript for iTunes. see below.
-- in Geektool: osascript "/Users/ah/Documents/Documents etc/applescripts/itunes.scpt"

-- First things first, we're going to check if iTunes is running:
tell application "System Events"
if name of processes contains "iTunes" then

-- Now we know it's running, let's see if it's playing anything:
tell application "iTunes"
if player state is playing then
-- If it's playing, let's get all the info we're going to need:
-- Get Track Title
set currtrack to name of current track

-- Get Track Artist
set currartist to artist of current track

-- Get Track Album
set curralbum to album of current track

-- Get Track Rating
set currrate to round (rating of current track) / 20

-- Get Track Position
set timeVal to player position

-- player position returns number of seconds, so let's make it hours/minutes/seconds.
-- the seconds -> hh:mm:ss script is from Doug's Applescripts for iTunes
-- (dougscripts.com/itunes/s...=3#replaylastbit)
-- I found the script via iPodLounge.
set numHours to (timeVal div hours)
set timeVal to timeVal - (numHours * hours)
set numMinutes to (timeVal div minutes)
set numSeconds to timeVal - (numMinutes * minutes)

-- build a zero-padded string
set timeStr to "" as string

-- format the hours. only show if time is 1 hour or more
-- the if > 0 part was added by me for greater functionality
if (numHours > 0) then
if (numHours < 10) then set timeStr to "0"
set timeStr to (timeStr & numHours)
set timeStr to (timeStr & ":")
end if

-- format the minutes
if (numMinutes < 10) then set timeStr to (timeStr & "0")
set timeStr to (timeStr & numMinutes)

-- format the seconds
set timeStr to (timeStr & ":")
if (numSeconds < 10) then set timeStr to (timeStr & "0")
set timeStr to (timeStr & numSeconds)

-- thanks Doug!


-- Now, we have all the info, so let's get some output happening here

-- First, let's make a string called title info, that looks like
-- Track by Artist on Album
set titleinfo to (currtrack & " by " & currartist & " on " & curralbum)

-- We've set up a nice box in Geektool that fits between the
-- corner of the screen and the edge of the dock. we don't
-- want the text to wrap to the next line, because that's ugly.
-- Geek tool can automatically cut it off, but that's also ugly.

-- Instead, let's cut it off at a certain point if it's too long
-- and replace the last few characters with an ellipsis, which
-- looks much prettier. 54 is the gap for my dock, you might need
-- to change it for a higher/lower resolution or if you have more
-- in your dock than i do. Also, I recommend using a fixed-width
-- font [i use Monaco] so it's consistent.
if length of titleinfo > 54 then
set titleinfo to characters 1 thru 56 of titleinfo & "..." as text
end if


-- next, we'll make a string called trackinfo, which will be
-- the length, rating and track number of what's playing.
-- first, get the total time of the track
set timetotal to time of current track

-- if the total time is less than 5 digits [four plus a colon]
-- add a 0 to the front so it's the same format as the current time.
if length of timetotal < 5 then
set timetotal to "0" & timetotal
end if

-- then, get the track number in the playlist of whatever's playing
set tracksleft to index of current track

-- then count the total number of tracks in the playlist
set trackstotal to count every track in current playlist

-- and output it all like such:
-- (# stars) 00:00/00:00, # of #
set timeinfo to "(" & currrate & " stars) " & timeStr & "/" & timetotal & ", " & tracksleft & " of " & trackstotal


-- because we have growltunes running, and it pops up with that
-- music video thing at the beginning of each song, we're going
-- to make the output blank for the first 5 seconds of the song
-- because it would be block by the growl thing anyway
if player position < 4 then
set output to ""
else


-- for the rest of the song, though, we want the output to be all the
-- stuff we've already organised. it will be formatted like this:
-- Song by Artist on Album [line break: "/r
-- (# stars) 00:00/00:00, # of #
-- if we set up geektool to update this once a second, the first counter
-- will go up each second.
set output to titleinfo & "
" & timeinfo
end if
end if
end tell
end if
end tell

Vielen Dank für eure Hilfe...:cool:
 
Zurück
Oben Unten