Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
Status
Not open for further replies.
Couldn't be bothered to read all the pages, but i saw some people in need of itunes codes



Itunes Ratings with Stars (Includes 1/2 ratings)

Code:
set newline to ASCII character 10
tell application "System Events"
	set powerCheck to ((application processes whose (name is equal to "iTunes")) count)
	if powerCheck = 0 then
		return ""
	end if
end tell
tell application "iTunes"
	try
		set playerstate to (get player state)
	end try
	if playerstate = paused then
		set trackPaused to " (paused)"
	else
		set trackPaused to ""
	end if
	if playerstate = stopped then
		return "Stopped"
	end if
	set trackID to the current track
	
	
	
	
	set stars to the rating of trackID
	if stars = 0 then
		set stars to "No Rating" as text
	end if
	if stars = 10 then
		set stars to "☆" as text
	end if
	if stars = 20 then
		set stars to "★" as text
	end if
	if stars = 30 then
		set stars to "★☆" as text
	end if
	if stars = 40 then
		set stars to "★★" as text
	end if
	if stars = 50 then
		set stars to "★★☆" as text
	end if
	if stars = 60 then
		set stars to "★★★" as text
	end if
	if stars = 70 then
		set stars to "★★★☆" as text
	end if
	if stars = 80 then
		set stars to "★★★★" as text
	end if
	if stars = 90 then
		set stars to "★★★★☆" as text
	end if
	if stars = 100 then
		set stars to "★★★★★" as text
	end if
	set totalData to stars & ""
	return totalData
end tell

Song Name - Artist Name - Album


Code:
 set the_string to ""

tell application "iTunes"
	if player state is playing then
		set the_string to "" & name of current track & ""
		if artist of current track is not "" then
			set the_string to the_string & " - " & artist of current track
		end if
		if album of current track is "" and year of current track is 0 then
			set the_string to the_string
		else if album of current track is not "" and year of current track is not 0 then
			set the_string to the_string & " (" & album of current track & ", " & year of current track & ")"
		else if year of current track is not 0 then
			set the_string to the_string & " (" & year of current track & ")"
		else if album of current track is not "" then
			set the_string to the_string & " (" & album of current track & ")"
		end if
	else
		set the_string to "Not Playing"
	end if
end tell

return the_string

Itunes Rating with words, (easily changeable if you know simple applescript)

Code:
set newline to ASCII character 10
tell application "System Events"
	set powerCheck to ((application processes whose (name is equal to "iTunes")) count)
	if powerCheck = 0 then
		return ""
	end if
end tell
tell application "iTunes"
	try
		set playerstate to (get player state)
	end try
	if playerstate = paused then
		set trackPaused to " (paused)"
	else
		set trackPaused to ""
	end if
	if playerstate = stopped then
		return "Stopped"
	end if
	set trackID to the current track
	
	
	
	
	set stars to the rating of trackID
	if stars = 0 then
		set stars to "Rate Me Aye?" as text
	end if
	if stars = 10 then
		set stars to "Pfft" as text
	end if
	if stars = 20 then
		set stars to "Come On" as text
	end if
	if stars = 30 then
		set stars to "Ehh" as text
	end if
	if stars = 40 then
		set stars to "Average" as text
	end if
	if stars = 50 then
		set stars to "Almost There" as text
	end if
	if stars = 60 then
		set stars to "It's Alright Aye" as text
	end if
	if stars = 70 then
		set stars to "Wow" as text
	end if
	if stars = 80 then
		set stars to "Keep It Loud" as text
	end if
	if stars = 90 then
		set stars to "Excellent" as text
	end if
	if stars = 100 then
		set stars to "****en Ace" as text
	end if
	set totalData to stars & ""
	return totalData
end tell

Enjoy
 
I changed wednesday for wed..gives it a more minimal look


Screenshot2010-08-04at82749PM.png
 
Thanks for the code!

Hey mate i got a post notification from you about you not being able to use the code? its not showing anymore so i don't know if u removed it or what.
but anyway
it is an applescript so you can't just plug it straight into geektool, you need to open it in "applescript editor" and save it, then you need to point geektool to that file location...im sure there are tuts on how to do this, if not give us a shout
good luck
 
Hey mate i got a post notification from you about you not being able to use the code? its not showing anymore so i don't know if u removed it or what.
but anyway
it is an applescript so you can't just plug it straight into geektool, you need to open it in "applescript editor" and save it, then you need to point geektool to that file location...im sure there are tuts on how to do this, if not give us a shout
good luck

Hey! Haha literally one minute after posting that, I realized I needed to add in the osasomething line and after that it worked. Go figure, I felt stupid for not being able to figure that out until a couple hours later. -_-

On another note, I have two questions for you/anybody else out there.

1) Is there a code for ichat/aim/adium? I've seen it numerous times and have been desparately trying to find the code the people used for geektool to have it in the background like that. It seems everytime somebody asks not too many people respond for whatever reason.

2) Looking at the picture below, is there a way to get the icon right next to the itunes song/artist to show up again? I just want that icon/artist/track name, not that whole grey window. (The icon next to Regular Day by Josh Martinez).

 
Hey! Haha literally one minute after posting that, I realized I needed to add in the osasomething line and after that it worked. Go figure, I felt stupid for not being able to figure that out until a couple hours later. -_-

On another note, I have two questions for you/anybody else out there.

1) Is there a code for ichat/aim/adium? I've seen it numerous times and have been desparately trying to find the code the people used for geektool to have it in the background like that. It seems everytime somebody asks not too many people respond for whatever reason.

2) Looking at the picture below, is there a way to get the icon right next to the itunes song/artist to show up again? I just want that icon/artist/track name, not that whole grey window. (The icon next to Regular Day by Josh Martinez).

I figured out how to get an ichat script working so it shows the ichat buddies, but is there a way to have it show up like that but be able to select people from the list and start talking to them? Or would you need to code a whole new instant messenger client or something like that? In all the pics I've seen, it doesn't really show if you can do that or not.
 
result of much fiddling :)

2mgrqsk.png
i definitely love your setup... maybe a bit too full, but really cool.
1) you should move the day of the week and the month cuz with the date changing, they're gonna be on top of the date.
2) mind giving the script for the vertical calendar? i have the horizontal one but not this one... and while youre at it, if you dont mind, the %CPU one too? :)
3) i think that the "it is about 76 in the city of new york" is kinda useless since you have the widget with the temperature on it...
4) i also love your dock icons... did you make them yourself?
 
lol zero.
put them there for sheer amusement.


Hey how'd you get your calender to be like that (where it's going straight down with the corresponding numbers)? Also, do you know how to get that same effect but horizontal instead of vertical?
 
i definitely love your setup... maybe a bit too full, but really cool.
1) you should move the day of the week and the month cuz with the date changing, they're gonna be on top of the date.
2) mind giving the script for the vertical calendar? i have the horizontal one but not this one... and while youre at it, if you dont mind, the %CPU one too? :)
3) i think that the "it is about 76 in the city of new york" is kinda useless since you have the widget with the temperature on it...
4) i also love your dock icons... did you make them yourself?

lol yeah i noticed that once it hit the 7th.. ><

vertical calendar: http://geektool.lost-interrupt.de/vertical-calendar/index.php

CPU monitor: http://forums.mactalk.com.au/18/51067-learning-love-geektool-primer-part-2-a.html (first part)

and dock icons are Latext II from neodesktop on deviantart: http://theyaresodoingit.deviantart.com/favourites/#/d2kd57u
 
My Geektools

Set this up yesterday, took ages to get cpu working.
 

Attachments

  • Stripes.jpg
    Stripes.jpg
    516 KB · Views: 216
.5 1 .5 month layout

I worked out a calendar that uses the cal command, but also includes the last two weeks of the previous month, and the first two weeks of the next month and combines them together seamlessly under one month heading. This gives it a square layout. I also used some coloring to help tell the months apart and show the progress of the current month and highlight the current day. I haven't tested it with many other months, so may need some tweaking, but for now looks good.

Edit [20100905]: Fixed a few things in the code that miss-colored items this month.
Edit [20101201]: Improved code to fix issues losing January when it was the next month.
Code:
MONTH=$(date +'%B %Y')
OFFSET=$(((21-${#MONTH})/2))
WEEK="Su Mo Tu We Th Fr Sa"
PREV=$(cal -mj $(date -v -1m "+%m %Y") | grep .. | tail -n2)
CURR=$(cal | tail -n6)
NEXT=$(cal -mj $(date -v +1m "+%m %Y") | grep .. | tail -n6 | head -n2)
LINE=$((($(date +%e)/7)+2))

for ((i=0; i<$OFFSET; i++ ))
do
	echo " \c"
done
echo ""$MONTH""
echo $WEEK $PREV$CURR$NEXT | sed -e s'/$/ /g' -e s'/ /  /g' -e s'/\([^0-9][0-9][^0-9]\)/ \1/g' -e s'/  / /g' -e s"/\(.\{21\}\)/\1#/g" | tr -s '#' '\n' | sed -e s'/^/ /g' -e s'/Sa/Sa/' -e '3,5 s/ 1 / 1 /' -e '7,9 s/ 1 / 1 /' -e "$LINE,$(($LINE+2)) s/ $(date +%e | sed s'/ //') /$(date +%e | sed -e s'/ //' -e s'/\(.*\)/ \1 /')/"
For entering escaped characters before the [0m bits, you hit control+q [release] esc. It's invisible so you won't get any feedback.
 

Attachments

  • geektool-5-1.5-month.png
    geektool-5-1.5-month.png
    25.4 KB · Views: 2,832
Last edited:
Can someone point me to a quick tutorials guys on how to install your scripts. I have seen a few on youtube but they were just explaining how to create (visually) simple things.

Thanks
 
Week starting on Monday

Another version, should do exactly the same:
Code:
#!/bin/bash

# Helper function to display a month in the past or future
Cal() { cal $(date -v$1m '+%m %Y') | sed 's/^/ /';}

# Previous month
Cal -1

# Current month, put parenthesis around current day
# Replace (\\1) by [\\1] to display square brackets for example
ruby -e 'print `cal`.gsub(/^/, " ").sub(/ \b(#{Time.now.day})\b ?/,"(\\1)")'

# Next month
Cal +1

Looks like this:
Code:
    November 2009
 Su Mo Tu We Th Fr Sa
  1  2  3  4  5  6  7
  8  9 10 11 12 13 14
 15 16 17 18 19 20 21
 22 23 24 25 26 27 28
 29 30
 
    December 2009
 Su Mo Tu We Th Fr Sa
        1  2 (3) 4  5
  6  7  8  9 10 11 12
 13 14 15 16 17 18 19
 20 21 22 23 24 25 26
 27 28 29 30 31
 
     January 2010
 Su Mo Tu We Th Fr Sa
                 1  2
  3  4  5  6  7  8  9
 10 11 12 13 14 15 16
 17 18 19 20 21 22 23
 24 25 26 27 28 29 30
 31

Hi, thanks for such a nice script. However, is it possible to make it start the week on Monday instead of Sunday? Thanks in advance...
 
alright, im using this script (just putting the link)
http://forums.mactalk.com.au/18/51067-learning-love-geektool-primer-part-2-a.html
for my cpu processes. PROBLEM. my cpu time and cpu mem don't refresh. so the cpu% is the only one "moving"....what gives?

also does anyone have a script for temperature (not the weather, my cpu)-
snow leopard btw.
thanks.

for cpu temp:
http://www.r0ssar00.com/2009/03/geektool.html

see number 21; and then i believe the second comment provides a link to the script and command and explains it.
 
Status
Not open for further replies.
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.