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.
I got the iTunes meter to work no problem, but the fan speeds just won't work. I stored both fan.sh and smc.custom in the same folder, made them both executable and then in Geektool (Shell) osascript /path/to/script/fans.sh and it just won't work. Nothing appears. When I click on the raw file of fans.sh it opens a very short document in text edit. Is this correct?

osascript precedes the path to the script only for apple scripts. You just need to type /path/to/fans.sh in shell. If it still isn't working, try running it in terminal and see what happens. (type ./fans.sh once you are in the directory where it's kept.)
 
Just a simple time script up left and iTunes under the pyramid.
 

Attachments

  • Picture 1.jpg
    Picture 1.jpg
    182.5 KB · Views: 662
Echo Script

Could write me a quick script (shell) that will echo the Words "iTunes Info:" but only when iTunes is open? So I want it to disappear when iTunes isn't open just like my song info and song meter do. Thank you.
 
does anybody have a working download link to get lynx? the apple download one wont work.
 
Could write me a quick script (shell) that will echo the Words "iTunes Info:" but only when iTunes is open? So I want it to disappear when iTunes isn't open just like my song info and song meter do. Thank you.

I could do that in applescript no prob. Is that okay?
 
next 5 songs itunes applescript for geektool

Just whipped this up. It outputs the next 5 songs in iTunes. Paste the code into script editor, save it as whatever (I called mine "nexttunes.scpt") and type "osascript /path/to/script" under shell in geektool.

Code:
set newline to ASCII character 10
set finalText to ""
tell application "iTunes"
	repeat with i from 1 to 5
		set trackName to name of track ((index of current track) + i) of current playlist
		set artistName to artist of track ((index of current track) + i) of current playlist
		set finalText to finalText & i & ". " & trackName & " by " & artistName & newline
	end repeat
end tell

Enjoy!

EDIT:: Oh ya, if you want to display international character for this or any other script, just add " | \iconv -f utf-8 -t ucs-2-internal" after the path to the script under shell.
 
can someone please give me the script to make the monthly calendar
appear in a line of numbers, not a block like normal calendars

thanks :D

Code:
echo
echo `cal` | 
sed "s/$(date +%e) / $(date +%e | sed 's/.*/@/g') /" | 
sed s'/Su Mo Tu We Th Fr Sa//g' | 
sed s'/  */  \|  /g' | 
sed s'/^  \|//' | sed s'/  \|//' | sed s'/\|/  /' | 
sed s'/\|/./g' | sed s"/$/      $(date +%A)/"

or

Code:
cal | sed -e '1d' -e '2p;2p;2p;2p' | sed -e '$!N;s/\n/ /' -e '$!N;s/\n/ /' -e '$!N;s/\n/ /' -e '$!N;s/\n/ /' | sed "s/^/ /;s/$/ /;s/ $(date +%e) /\|$(date +%e)\|/"

Both work but I like the top one better.
Edit:
First code fixed
Image attachment edited
Top code is shown in white (can be made into one line but shortened to fit in image), bottom code is in black
 

Attachments

  • 11.gif
    11.gif
    55.3 KB · Views: 618
I could do that in applescript no prob. Is that okay?

Yes. thank you, just have it say "iTunes Info:"
Where did you learn to applescript, I'm learning basic C and C++ right now and java in school next year. I think applescript would be a good addition to my knowledge.
 
Code:
echo
echo `cal` | 
sed "s/$(date +%e) / $(date +%e | sed 's/.*/@/g') /" | 
sed s'/Su Mo Tu We Th Fr Sa//g' | 
sed s'/  */  \|  /g' | 
sed s'/^  \|//' | sed s'/  \|//' | sed s'/\|/  /' | 
sed s'/\|/./g' | sed s"/$/      $(date +%A)/"

or

Code:
cal | sed -e '1d' -e '2p;2p;2p;2p' | sed -e '$!N;s/\n/ /' -e '$!N;s/\n/ /' -e '$!N;s/\n/ /' -e '$!N;s/\n/ /' | sed "s/^/ /;s/$/ /;s/ $(date +%e) /\|$(date +%e)\|/"

Both work but I like the top one better.
Edit:
First code fixed
Image attachment edited
Top code is shown in white (can be made into one line but shortened to fit in image), bottom code is in black


thank you sir :D
 
Code:
echo
echo `cal` | 
sed "s/$(date +%e) / $(date +%e | sed 's/.*/@/g') /" | 
sed s'/Su Mo Tu We Th Fr Sa//g' | 
sed s'/  */  \|  /g' | 
sed s'/^  \|//' | sed s'/  \|//' | sed s'/\|/  /' | 
sed s'/\|/./g' | sed s"/$/      $(date +%A)/"

I was wondering if you could do a quick edit for me on the first script. Could you make it so it doesn't say the day such as Thursday at the bottom. And also, could you make it so instead of the . after each day it has the actual day? So next to 11 it would say TH for Thursday? Something similar to me attachment. Your probably thinking, why I don't just use what I already have, but actually that isn't running, it's just two files with dates that I arranged next to each other. Thanks.
 

Attachments

  • Picture 1.png
    Picture 1.png
    33.3 KB · Views: 165
Yes. thank you, just have it say "iTunes Info:"
Where did you learn to applescript, I'm learning basic C and C++ right now and java in school next year. I think applescript would be a good addition to my knowledge.

Here ya go:

Code:
tell application "System Events"
	set powerCheck to ((application processes whose (name is equal to "iTunes")) count)
	if powerCheck = 1 then
		return "iTunes Info:"
	else
		return ""
	end if
end tell

Also, I'm not sure if this is the iTunes info script you have, but I modified the one I have (mine has ratings and adds "..." when the number of characters reach a certain length) to output "iTunes Info:" at the top so if you like you don't have to use two different scripts:

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 trackName to the name of trackID
	if length of trackName > 45 then
		set trackName to characters 1 thru 45 of trackName & "..." as text
	end if
	set artistName to the artist of trackID
	if length of artistName > 45 then
		set artistName to characters 1 thru 45 of artistName & "..." as text
	end if
	set albumName to the album of trackID
	if length of albumName > 45 then
		set albumName to characters 1 thru 45 of albumName & "..." as text
	end if
	set stars to the rating of trackID
	if stars = 0 then
		set stars to "No Rating" as text
	end if
	if stars = 20 then
		set stars to "*" as text
	end if
	if stars = 40 then
		set stars to "* *" as text
	end if
	if stars = 60 then
		set stars to "* * *" as text
	end if
	if stars = 80 then
		set stars to "* * * *" as text
	end if
	if stars = 100 then
		set stars to "* * * * *" as text
	end if
	set totalData to "iTunes Info:" & newline & "Track : " & trackName & trackPaused & "
Artist : " & artistName & "
Album : " & albumName & "
Rating : " & stars & ""
	return totalData
end tell

To answer your question, I learned some basic applescript just by looking at and modifying other people's scripts. Applescript is super easy. If you're interested, check out http://dougscripts.com for some good examples of itunes scripts.

Best,

Thom
 
Also, is there any way to get the text on a slight angle?

Thank you

Yeah, but it's not very easy.

To generate an image with ImageMagick:
Code:
date | /opt/local/bin/convert -rotate 10 -background none -fill white -pointsize 22 label:@- -trim ~/label.png

Step by step:
1. Install MacPorts.
2. Install ImageMagick through MacPorts.
3. Set up an entry in GeekTool to do the above shell script. Make sure to replace "date" with whatever command you actually want it to display.
4. Set up an entry in GeekTool to display the image generated by the above shell script (in this case file:///Users/yourusername/label1.png).


This is pretty similar to the approach I used for the analog clock (see page 18, post 449).

Also note that the output will always be slightly behind (up to 20 seconds) what it should be.
 
I was wondering if you could do a quick edit for me on the first script. Could you make it so it doesn't say the day such as Thursday at the bottom. And also, could you make it so instead of the . after each day it has the actual day? So next to 11 it would say TH for Thursday? Something similar to me attachment. Your probably thinking, why I don't just use what I already have, but actually that isn't running, it's just two files with dates that I arranged next to each other. Thanks.

Anything?
 
I was wondering if you could do a quick edit for me on the first script. Could you make it so it doesn't say the day such as Thursday at the bottom. And also, could you make it so instead of the . after each day it has the actual day? So next to 11 it would say TH for Thursday? Something similar to me attachment. Your probably thinking, why I don't just use what I already have, but actually that isn't running, it's just two files with dates that I arranged next to each other. Thanks.

Firstly, no, I am not wondering why you don't use the method used in the image because I was the one who explained how to do this for you several pages ago. :)

Secondly, while no offense is intended, you would get far better results in asking for assistance if you didn't post
Anything?
less than 24hrs after the original post asking for help. Even if I didn't have two 3 hr exams in that time frame (which I did) it does take a bit of time to modify scripts with absolutely to experience in any sort of code - which i also explained to you two pages ago.

Here is the code, without full stops after each date, with a clearer indication of the current date and so it doesn't give the day after the list of dates (shown in image attached)

Code:
echo
echo `cal` | 
sed "s/$(date +%e) / $(date +%e | sed 's/.*/###/g') /" | 
sed s'/Su Mo Tu We Th Fr Sa//g' | 
sed s'/  */  \|  /g' | 
sed s'/^  \|//' | sed s'/  \|//' | sed s'/\|/  /' | 
sed s'/\|//g' | sed s"/$//"

I haven't figured out how to get the shortened day after each date and, frankly, I'm not sure if I will. I'll probably have a play with the code in a week once exams have finished.
 

Attachments

  • 1.jpg
    1.jpg
    19.7 KB · Views: 123
Firstly, no, I am not wondering why you don't use the method used in the image because I was the one who explained how to do this for you several pages ago. :)

Secondly, while no offense is intended, you would get far better results in asking for assistance if you didn't post

less than 24hrs after the original post asking for help. Even if I didn't have two 3 hr exams in that time frame (which I did) it does take a bit of time to modify scripts with absolutely to experience in any sort of code - which i also explained to you two pages ago.

Here is the code, without full stops after each date, with a clearer indication of the current date and so it doesn't give the day after the list of dates (shown in image attached)

Code:
echo
echo `cal` | 
sed "s/$(date +%e) / $(date +%e | sed 's/.*/###/g') /" | 
sed s'/Su Mo Tu We Th Fr Sa//g' | 
sed s'/  */  \|  /g' | 
sed s'/^  \|//' | sed s'/  \|//' | sed s'/\|/  /' | 
sed s'/\|//g' | sed s"/$//"

I haven't figured out how to get the shortened day after each date and, frankly, I'm not sure if I will. I'll probably have a play with the code in a week once exams have finished.

I'm very very sorry, I was up all day making computer and I was in a really bad mood and was very rude, please forgive me and thank you for the script.
 
Lynx

Has anyone had any luck finding a version of Lynx for download ?? All the official sources seem to have been down for days now.

Also - can anyone point me in the direction for an easy to follow guide for sed and awk ?? I have been trying for days to manipulate a block of text from the Australian Bureau of Meteorology site (using curl) but I just cant get my head around sed and awk !!!

Thanks guys.

***edit***
I found this link whilst poking round the osxgnu ftp site

ftp://us.osxgnu.org:21//Networking/Lynx-2.8.7d13-10.5.6+u.dmg.zip
 
More thanks to Donnyboy and his nifty scripts, I've modified mine to this... I'll have to see how the 'TODAY' lines up each day, not sure if it'll work or push things out of line too much.
 

Attachments

  • Geektools.jpg
    Geektools.jpg
    46.9 KB · Views: 120
Just whipped this up. It outputs the next 5 songs in iTunes. Paste the code into script editor, save it as whatever (I called mine "nexttunes.scpt") and type "osascript /path/to/script" under shell in geektool.

Code:
set newline to ASCII character 10
set finalText to ""
tell application "iTunes"
	repeat with i from 1 to 5
		set trackName to name of track ((index of current track) + i) of current playlist
		set artistName to artist of track ((index of current track) + i) of current playlist
		set finalText to finalText & i & ". " & trackName & " by " & artistName & newline
	end repeat
end tell

Enjoy!

EDIT:: Oh ya, if you want to display international character for this or any other script, just add " | \iconv -f utf-8 -t ucs-2-internal" after the path to the script under shell.

Can anyone get this to work even when shuffle is on?
 
Can anyone get this to work even when shuffle is on?

As far as I know, there is no way to get an applescript to show what songs are coming up next in shuffle mode because iTunes makes those determinations as to what song it will play next on the fly (though you might want to check with Doug of the famous Doug's iTunes Scripts). The script i posted will however work in iTunes DJ. For posterity's sake, here's a variation on the script which just shows the next two songs with the descriptors "NEXT:" and "THEN:", as I find my desktop is getting a little crowded these days:

Code:
set newline to ASCII character 10
set finalText to ""
tell application "iTunes"
	repeat with i from 1 to 2
		set trackName to name of track ((index of current track) + i) of current playlist
		set artistName to artist of track ((index of current track) + i) of current playlist
		if i = 1 then
			set finalText to finalText & "NEXT: " & trackName & " by " & artistName & newline
		else
			set finalText to finalText & "THEN: " & trackName & " by " & artistName & newline
		end if
	end repeat
end tell

By the way, I think it's great that we have this vibrant community of desktop customization enthusiasts and the free exchange of code that permits this, but please, say thank you when somebody does you a solid and posts a script you requested.

Word 'em up,

Thom
 
As far as I know, there is no way to get an applescript to show what songs are coming up next in shuffle mode because iTunes makes those determinations as to what song it will play next on the fly (though you might want to check with Doug of the famous Doug's iTunes Scripts). The script i posted will however work in iTunes DJ. For posterity's sake, here's a variation on the script which just shows the next two songs with the descriptors "NEXT:" and "THEN:", as I find my desktop is getting a little crowded these days:

snip

By the way, I think it's great that we have this vibrant community of desktop customization enthusiasts and the free exchange of code that permits this, but please, say thank you when somebody does you a solid and posts a script you requested.

Word 'em up,

Thom

I was considering using a whole library playlist (since you can't order the 'Library' by shuffle order, but you can with any playlist), but I would like a system which works regardless, for consistency.

Btw, as soon as you turn on shuffle in iTunes, the play order is set. You can see this by ordering by the numbered column in a playlist. You can also discover this nuisance if you leave your library on permanent shuffle, if you manually select a song you like while on shuffle...it always plays the same sequence of songs afterwards.

Oh and, thanks for that script, yeah, it only works in a playlist.

EDIT: Works perfectly in a playlist! :) Pic: modded 'minimalmod' bowtie, plus geektool next songs. Not a big fan of geektool text clutter.
 

Attachments

  • Picture 1.png
    Picture 1.png
    220.1 KB · Views: 206
Massive Memory Leak

So there happens to be a minor memory leak in the 4th Beta of Geektool 3. It seems to pile on about 12 MB everytime you bring the focus to the preference pane (say you click on the Finder to look at your geektool setup, then click back to edit).

Disabiling and re-enabling it from the GT pref pane will reset the memory.
 

Attachments

  • Picture 1.png
    Picture 1.png
    26.3 KB · Views: 218
Status
Not open for further replies.
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.