Hello! I just discovered Geektool last night and have been going crazy with all the options. I found a really cool geeklet that displays the itunes song rating, but right now it only displays the number of stars in the rating. I figured out how to display 5 "white" stars when it has no rating, but my attempts to always display 5 stars is failing. Here is the script I came up with so far...
#!/usr/bin/osascript
on run
set info to ""
tell application "System Events"
set num to count (every process whose name is "iTunes")
end tell
if num > 0 then
tell application "iTunes"
set how to rating of current track
if how is 0 then return "☆☆☆☆☆"
if how is 1 then return "★☆☆☆☆"
if how is 2 then return "★★☆☆☆"
if how is 3 then return "★★★☆☆"
if how is 4 then return "★★★★☆"
if how is 5 then return "★★★★★"
set how to how / 20 as integer
set star to {"★"}
set infoitems to {}
set starnum to 0
repeat
set infoitems to infoitems & star
set starnum to starnum + 1
if starnum = how then exit repeat
end repeat
set info to infoitems as string
end tell
end if
return info
end run
I totally added all the "if how is" 1-5; if how is 0 works but all the other ones only display the number of stars in the rating.
Any help would be much appreciated, thank you!
----------
All I had to do was move the "if how is" 1-5 until AFTER I set how.
This is the new code, for anyone that wants to use this updated one...
#!/usr/bin/osascript
on run
set info to ""
tell application "System Events"
set num to count (every process whose name is "iTunes")
end tell
if num > 0 then
tell application "iTunes"
set how to rating of current track
if how is 0 then return "☆☆☆☆☆"
set how to how / 20 as integer
if how is 1 then return "★☆☆☆☆"
if how is 2 then return "★★☆☆☆"
if how is 3 then return "★★★☆☆"
if how is 4 then return "★★★★☆"
if how is 5 then return "★★★★★"
set star to {"★"}
set infoitems to {}
set starnum to 0
repeat
set infoitems to infoitems & star
set starnum to starnum + 1
if starnum = how then exit repeat
end repeat
set info to infoitems as string
end tell
end if
return info
end run
GEEKTOOL IS AMAZING, I haven't done anything else in the past day!!!!! Will post my desktop once I get it perfect. HAHA!
#!/usr/bin/osascript
on run
set info to ""
tell application "System Events"
set num to count (every process whose name is "iTunes")
end tell
if num > 0 then
tell application "iTunes"
set how to rating of current track
if how is 0 then return "☆☆☆☆☆"
if how is 1 then return "★☆☆☆☆"
if how is 2 then return "★★☆☆☆"
if how is 3 then return "★★★☆☆"
if how is 4 then return "★★★★☆"
if how is 5 then return "★★★★★"
set how to how / 20 as integer
set star to {"★"}
set infoitems to {}
set starnum to 0
repeat
set infoitems to infoitems & star
set starnum to starnum + 1
if starnum = how then exit repeat
end repeat
set info to infoitems as string
end tell
end if
return info
end run
I totally added all the "if how is" 1-5; if how is 0 works but all the other ones only display the number of stars in the rating.
Any help would be much appreciated, thank you!
----------
All I had to do was move the "if how is" 1-5 until AFTER I set how.
This is the new code, for anyone that wants to use this updated one...
#!/usr/bin/osascript
on run
set info to ""
tell application "System Events"
set num to count (every process whose name is "iTunes")
end tell
if num > 0 then
tell application "iTunes"
set how to rating of current track
if how is 0 then return "☆☆☆☆☆"
set how to how / 20 as integer
if how is 1 then return "★☆☆☆☆"
if how is 2 then return "★★☆☆☆"
if how is 3 then return "★★★☆☆"
if how is 4 then return "★★★★☆"
if how is 5 then return "★★★★★"
set star to {"★"}
set infoitems to {}
set starnum to 0
repeat
set infoitems to infoitems & star
set starnum to starnum + 1
if starnum = how then exit repeat
end repeat
set info to infoitems as string
end tell
end if
return info
end run
GEEKTOOL IS AMAZING, I haven't done anything else in the past day!!!!! Will post my desktop once I get it perfect. HAHA!