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 cant remember why I downloaded lynx or what tutorial I was following, May have been for the rss feed. Any ideas on how to uninstall it?
 
good idea using AppleScript for the weather! never thought about doing it this way... ;) this only shows that you can do pretty much ANYTHING with AS when you know the basis!
- but for your script, we only need to know which image correspond to which weather (sunny is which, rain, etc.)
- and for the forecast, what is the difference between "w-fore0" and "w-fore1" in the forecast. is it tomorrow and the day after tomorrow?
- also, id like to point out that it actually works for all the cities in the world!
and thanks alot for that! this is a lot more flexible and a lot cooler than the old (but practical) way (coolenufforamac)

edit: oh, and while youre at it, what is the script for the "last actions" there, it could be pretty useful! :)

OK. First the answers to the questions :)

To get the corresponding codes for the weather icons, goto:

http://developer.yahoo.com/weather/

There is a condition codes table at the end of the page. If you use a different set of icons, just use the numbers as the file name. Like:

0.png

As for the variables, w_fore0 and others similarly named will be for the current date. w_fore1 will be for tomorrow's date. Yahoo API doesn't expose any more data into the future.

You asked about a last actions script. Are you talking about my my time machine log? Or my CPU/Memory/uptime?

eyekyu asked for the IP geekets. Here they are:

WAN:
Code:
echo "WAN :" `curl --silent http://checkip.dyndns.org | awk '{print $6}' | cut -f 1 -d "<"`

LAN:
Code:
echo "LAN :" `ifconfig en0 | grep "inet " | awk '{print $2}'`
LAN data rate:
Code:
#!/bin/sh
# created by chris helming.
# chris dot helming at gmail

# get the current number of bytes in and bytes out
myvar1=`netstat -ib | grep -e "en0" -m 1 | awk '{print $7}'` #  bytes in
myvar3=`netstat -ib | grep -e "en0" -m 1 | awk '{print $10}'` # bytes out

#wait one second
sleep 1

# get the number of bytes in and out one second later
myvar2=`netstat -ib | grep -e "en0" -m 1 | awk '{print $7}'` # bytes in again
myvar4=`netstat -ib | grep -e "en0" -m 1 | awk '{print $10}'` # bytes out again

# find the difference between bytes in and out during that one second
subin=$(($myvar2 - $myvar1))
subout=$(($myvar4 - $myvar3))

# convert bytes to kilobytes
kbin=`echo "scale=2; $subin/1024;" | bc`
kbout=`echo "scale=2; $subout/1024;" | bc`

# print the results
echo "$kbin Kb/sec | $kbout Kb/sec"

Wifi:
Code:
echo "WiFi :" `ifconfig en1 | grep "inet " | awk '{print $2}'`
LAN data rate:
Code:
#!/bin/sh
# created by chris helming.
# chris dot helming at gmail

# get the current number of bytes in and bytes out
myvar1=`netstat -ib | grep -e "en1" -m 1 | awk '{print $7}'` #  bytes in
myvar3=`netstat -ib | grep -e "en1" -m 1 | awk '{print $10}'` # bytes out

#wait one second
sleep 1

# get the number of bytes in and out one second later
myvar2=`netstat -ib | grep -e "en1" -m 1 | awk '{print $7}'` # bytes in again
myvar4=`netstat -ib | grep -e "en1" -m 1 | awk '{print $10}'` # bytes out again

# find the difference between bytes in and out during that one second
subin=$(($myvar2 - $myvar1))
subout=$(($myvar4 - $myvar3))

# convert bytes to kilobytes
kbin=`echo "scale=2; $subin/1024;" | bc`
kbout=`echo "scale=2; $subout/1024;" | bc`

# print the results
echo "$kbin Kb/sec | $kbout Kb/sec"

I have the data rate refresh at a 3 sec interval. Anymore tends to make the CPU usage climb quickly. Also, these are not my scripts, I cribed them from someone else (who I have forgotten about now, sorry!)

Thanks for the feedback. Any thoughts to the overall look?
 
the presentation is really neat, probably one of the best in this thread

how did you get the lines separating everything? and what font is that if you dont mind all the questions
 
OK. First the answers to the questions :)

To get the corresponding codes for the weather icons, goto:

http://developer.yahoo.com/weather/

There is a condition codes table at the end of the page. If you use a different set of icons, just use the numbers as the file name. Like:

0.png

As for the variables, w_fore0 and others similarly named will be for the current date. w_fore1 will be for tomorrow's date. Yahoo API doesn't expose any more data into the future.

You asked about a last actions script. Are you talking about my my time machine log? Or my CPU/Memory/uptime?

eyekyu asked for the IP geekets. Here they are:

[...]

I have the data rate refresh at a 3 sec interval. Anymore tends to make the CPU usage climb quickly. Also, these are not my scripts, I cribed them from someone else (who I have forgotten about now, sorry!)

Thanks for the feedback. Any thoughts to the overall look?

thanks! ill look at it in the future...

and i just got it... its the time machine log... i thought it was a "last actions" of finder... :rolleyes: this could be cool doh... anyone has an idea if its even possible? (to let you know that you copied "stuff.doc" from the "Work" folder to the "Personal" folder at 9:25 PM )

the look is cool, even if i like things to be evenly displayed (left-right)...
is your iTunes info (on the menubar) done with geektool? i thought about doint that, but i dont have enough room! :p
and the black shading on the desktop... is it the picture itself or is it done with geektool?
also, i never understood people with 2 times... even if the effect is cool with the color... ;)
finally, the lines between the different codes, is it a separate geeklet?

thanks! :)

heres my desktop... changed since the last time... :D what do you guys think?
 

Attachments

  • Screen shot 2010-07-24 at 9.36.44 PM.png
    Screen shot 2010-07-24 at 9.36.44 PM.png
    685.5 KB · Views: 176
eyekyu - The lines are done by making a 0 refresh shell geeklet with a solid white background. It's only 1px tall and I set the opacity to 50%

The font is Helvetica Neue. I have used mostly Bold and Regular.

Ask any questions you like, though I am definitely not the foremost expert on some of this :)

brenm666 - The black shading is an overlay I made in Photoshop. It is an image geeklet, so you can change the opacity to taste. This way I can change the background easily to anything I like.

The iTunes in the menubar is a fantastic idea I picked up somewhere else (like many of my choices here!) It rarely becomes an issue, but sometimes shows it's ugly side. Thinking about revamping it a bit. I have tried Bowtie and several other iTunes scripts, but this is the best combination for me.

Your right about the time thing. It's extraneous, but I couldn't resist ;). It might be cool to show the UTC. (I will not get rid of my menu bar clock, because its ALWAYS visible, even in apps.)

I like your desktop, though I think the massive contrast would throw me off. It is well executed and well thought out!
 
I followed roebedo's instructions here for displaying my facebook feed on my desktop with geektool
HTML:
http://www.flickr.com/photos/24907007@N08/3409438091/
but the text file is full of duplicates. Can someone help me with this?
 
ok. now i need help.
i'm trying to do the "facebook notification" geeklet the way that Roebedo
HTML:
http://www.flickr.com/photos/24907007@N08/3409438091/
does it. he uses automator (a program that I never used before! and holy jesus its powerful!)
i got everything perfect, the automator workflow, the first geeklet (automator runner), the text file works like a charm, and the only thing i'm missing is the the head geeklet, to show the text file...

and if youre having trouble searching for the facebook rss feed, go here
HTML:
http://www.techlifeweb.com/2008/12/16/how-to-find-your-facebook-status-rss-feed/#comment-3518
.

and thanks noobsauce for reminding me this!

edit: found how to take off a part of the text file... just put a "Filter Paragraphs" (in "text") just before the "new text file" and put something like end with ".." it worked for me! :)
still cant find how to display a text file... i feel really dumb now...

edit2: finally got it to work... had to change the output encoding to mac roman... and the shell command cat [/path/to/file.txt] works better than the file geeklet... you read the first line when you adjust the size, and not the last...
 
I do not want to create Thread for that can you please answer 2 questions:

1. It looks like GeekTool havent been updated since Leopard. So does it work perfectly fine on Snow Leopard?

2. All this facny stuff does it uses a lot of resources? Specially if you are running on a battery?
 
1. Yes.
2. No.

Well it depends on what you consider alot ;) Yahoo Widgets uses more resources, but with GeekTool running my layout, I average between 5-10% CPU usage.

As far as battery life constant CPU usage COULD effect it, but the biggest draw of power in a moden laptop is the screen backlight. Compared to that, no, Geektool isn't a battery hog.
 
Well it depends on what you consider alot ;) Yahoo Widgets uses more resources, but with GeekTool running my layout, I average between 5-10% CPU usage.

As far as battery life constant CPU usage COULD effect it, but the biggest draw of power in a moden laptop is the screen backlight. Compared to that, no, Geektool isn't a battery hog.

So you guys mainly use it as a replacement for Dashboard with all those widgets?
 
So you guys mainly use it as a replacement for Dashboard with all those widgets?

I just like being able to tweak it. If I use Yahoo Widgets (Konfabulator) or the Dashboard, I am constrained to what it available. I am not a software developer, so this lets me customize to my taste (and with consistancy).

That said, the other options are GREAT tools. Did you know you can use Dashboard widgets right on the desktop?
 
I just like being able to tweak it. If I use Yahoo Widgets (Konfabulator) or the Dashboard, I am constrained to what it available. I am not a software developer, so this lets me customize to my taste (and with consistancy).

That said, the other options are GREAT tools. Did you know you can use Dashboard widgets right on the desktop?

Actually no, im on my second month with mac so if you dont mind enlighten me
 
Actually no, im on my second month with mac so if you dont mind enlighten me

The Dashboard has a developer mode that is disabled by default. You can enable it by going to the Terminal (in your Applications>Utilities folder) and typing in the following:

defaults write com.apple.dashboard devmode YES

Once that is done, enter the Dashboard (by pressing F12). Select a Widget you want on the desktop. Click on it and begin dragging. As you drag, press F12 again and the Widget will drop onto your Desktop.

There are several utilities out there that will allow this as well (if you don't want to mess with the Terminal). One that I use, that has a metric ton of other features is Onyx.

EDIT: One downside of this method is that the Widgets will float above open windows.
 
So my sunrise has stopped working on Geektool??
It just displays the sunset time in the sunrise spot??
So they both say 8:50pm

Anyone have any ideas??
This is the code I'm using for sunrise

curl --silent "http://weather.yahoo.com/united-states/washington/lynnwood-12798909/" | grep "Sunrise" | sed -e 's/.*\<dd\>/Sunrise: /' -e 's/<.*//'

This is my sunset code

curl --silent "http://weather.yahoo.com/united-states/washington/lynnwood-12798909/" | grep "Sunset" | sed -e 's/.*\<dd\>/Sunset: /' -e 's/<.*//'

Thanks for any help
 
So my sunrise has stopped working on Geektool??
It just displays the sunset time in the sunrise spot??
So they both say 8:50pm

Here you go; I rewrote part of the sed section so this should work for you to get the sunrise segment...

Code:
curl --silent "http://weather.yahoo.com/united-states/washington/lynnwood-12798909/" | grep "Sunrise" | sed -e 's/.*\<dt\>Sunrise:\<\/dt\>\<dd\>/Sunrise: /' -e 's/<.*//'
 
ok. now i need help.
i'm trying to do the "facebook notification" geeklet the way that Roebedo
HTML:
http://www.flickr.com/photos/24907007@N08/3409438091/
does it. he uses automator (a program that I never used before! and holy jesus its powerful!)
i got everything perfect, the automator workflow, the first geeklet (automator runner), the text file works like a charm, and the only thing i'm missing is the the head geeklet, to show the text file...

and if youre having trouble searching for the facebook rss feed, go here
HTML:
http://www.techlifeweb.com/2008/12/16/how-to-find-your-facebook-status-rss-feed/#comment-3518
.

and thanks noobsauce for reminding me this!

edit: found how to take off a part of the text file... just put a "Filter Paragraphs" (in "text") just before the "new text file" and put something like end with ".." it worked for me! :)
still cant find how to display a text file... i feel really dumb now...

edit2: finally got it to work... had to change the output encoding to mac roman... and the shell command cat [/path/to/file.txt] works better than the file geeklet... you read the first line when you adjust the size, and not the last...

Thanks, that filter paragraph bit was a godsend :D
 
Attached is a 3-month calendar with the current month progress and day highlighted. Below is the code for it.

Code:
cal -m $(($(date +%m)-1)) | sed -e s'/^/ /'
echo "\033[32m\c"
cal | sed "s/^/ /;s/$/ /;s/ $(date +%e | sed s'/ //') /$(date +%e | sed -e s'/ //' -e s'/\(.*\)/ [42;30m\1[0m /g')/"
cal -m $(($(date +%m)+1)) | sed -e s'/^/ /'
There are escaped characters on line 3. They are entered by doing a control+q esc (It's invisible when typed) and go right before the two [ chars toward the end of the line. When used inside a double quote area, you can use \033 instead, like on line 2. The coloring is done with ANSI color does. This page list the small list of codes.
@angelwatt or anyone else that can help
i used the code above for this and next month but from today (a new month) the code for next month has stopped working. Can anyone help me out?

This is the code:

cal -m $(($(date +%m)+1)) | sed -e s'/^/ /'

Many thanks
 
@angelwatt or anyone else that can help
i used the code above for this and next month but from today (a new month) the code for next month has stopped working. Can anyone help me out?

This is the code:

cal -m $(($(date +%m)+1)) | sed -e s'/^/ /'

Many thanks

Yeah that doesn't work for me when I ran it either, so after a quick rewrite, this code should work for next month....

Code:
cal -m $(date -v +1m | cut -f 2 -d ' ') | sed -e s'/^/ /'
 
Yeah that doesn't work for me when I ran it either, so after a quick rewrite, this code should work for next month....

Code:
cal -m $(date -v +1m | cut -f 2 -d ' ') | sed -e s'/^/ /'
Thanks very much. For you, Sir:
iconbeera.gif
 
@angelwatt or anyone else that can help
i used the code above for this and next month but from today (a new month) the code for next month has stopped working. Can anyone help me out?

I just noticed that this morning too. It was because the month "08" was being treated as base-8 and that's an invalid number. tag provided one solution, and below is an alternative solution that converts the 08 to an integer. For you, you only need the last line that has been updated.

Code:
cal -m $(($[10#$(date +%m)]-1)) | sed -e s'/^/ /'
echo "\033[32m\c"
cal | sed "s/^/ /;s/$/ /;s/ $(date +%e | sed s'/ //') /$(date +%e | sed -e s'/ //' -e s'/\(.*\)/ [42;30m\1[0m /g')/"
cal -m $(($[10#$(date +%m)]+1)) | sed -e s'/^/ /'
 
Inbox with unread highlighted

I managed a AppleScript script that will list the inbox and use a different color for the unread items. It took a bit more code because sorting the emails by date when you have more than one mailbox took some extra work with sorting. I set a max emails value at the top, currently 18, which you can modify. Attached is example output showing the first item is unread. The script moves unread emails to the top of the list to better ensure they will fit within the max setting. Enjoy!

Code:
osascript <<eos
tell application "Mail"
	try
		set {msgs, _a, _max} to {"", 0, 18}
		
		-- Sort messages by date received in descending order
		set theList to messages in inbox
		script bs
			property alist : theList
		end script
		set theCount to length of bs's alist
		if theCount ≥ 2 then
			repeat with indexA from theCount to 1 by -1
				repeat with indexB from 1 to indexA - 1
					if (date received of item indexB of bs's alist) < (date received of item (indexB + 1) of bs's alist) then
						set temp to item indexB of bs's alist
						set item indexB of bs's alist to item (indexB + 1) of bs's alist
						set item (indexB + 1) of bs's alist to temp
					end if
				end repeat
			end repeat
		end if
		set allmsgs to bs's alist
		
		repeat with _msg in allmsgs
			if read status of _msg is false then
				set _a to _a + 1
				set msgs to msgs & "
 " & _a & ". "
				if _a < 10 then set msgs to msgs & space
				set msgs to msgs & "[1;32m"
				set msgs to msgs & subject of _msg & "[0m"
			end if
		end repeat
		
		repeat with _msg in allmsgs
			repeat 1 times
				if _a is equal to _max then exit repeat
				if read status of _msg is false then exit repeat
				set _a to _a + 1
				set msgs to msgs & "
 " & _a & ". "
				if _a < 10 then set msgs to msgs & space
				if read status of _msg is false then set msgs to msgs & "[1;32m"
				set msgs to msgs & subject of _msg & "[0m"
			end repeat
		end repeat
		msgs
	on error estr
		estr
	end try
end tell
eos
Escape characters are used before the [1;32m and [0m pieces. To enter them properly you hit control+q [release] esc. This is an invisible character so you won't see it entered, but you can confirm it's there by moving your text cursor past it using the arrow keys and it will take an extra keystroke to move past it.
 

Attachments

  • geektool-inbox2.png
    geektool-inbox2.png
    88.4 KB · Views: 123
My nice simple layout
if you need any codes just ask
 

Attachments

  • Screen shot 2010-08-02 at 11.29.38 AM.jpg
    Screen shot 2010-08-02 at 11.29.38 AM.jpg
    307 KB · Views: 307
I improved upon the Mail inbox script I did 2 posts up. This one will has a column for date, sender, and subject now. It has the same max emails setting at the top. To adjust the width, there's a subjectWidth variable at the top that can be set.

Code:
osascript <<eos
global _max, _subjectWidth
set _max to 18
set _subjectWidth to 10

tell application "Mail"
	set {msgs, _a} to {"", 0}
	
	-- Sort messages by date received in descending order
	set theList to messages in inbox
	script bs
		property alist : theList
	end script
	set theCount to length of bs's alist
	if theCount ≥ 2 then
		repeat with indexA from theCount to 1 by -1
			repeat with indexB from 1 to indexA - 1
				if (date received of item indexB of bs's alist) < (date received of item (indexB + 1) of bs's alist) then
					set temp to item indexB of bs's alist
					set item indexB of bs's alist to item (indexB + 1) of bs's alist
					set item (indexB + 1) of bs's alist to temp
				end if
			end repeat
		end repeat
	end if
	set allmsgs to bs's alist
	-- Grab all of the unread messages first
	repeat with _msg in allmsgs
		if read status of _msg is false then
			set _a to _a + 1
			set msgs to msgs & return
			set msgs to msgs & formatMsg(_msg) of me
		end if
	end repeat
	-- Now get all other messages up to max amount
	repeat with _msg in allmsgs
		repeat 1 times
			if _a is equal to _max then exit repeat
			if read status of _msg is false then exit repeat
			set _a to _a + 1
			set msgs to msgs & return
			set msgs to msgs & formatMsg(_msg) of me
		end repeat
	end repeat
	msgs
end tell

on formatMsg(_msg)
	tell application "Mail"
		set msgs to ""
		if read status of _msg is false then set msgs to msgs & ""
		-- Date
		set _date to formattedDate(date received of _msg) of me
		set msgs to msgs & _date
		-- Name
		set _name to parseName(sender of _msg as text) of me
		set _name to toWidth(_name, _subjectWidth) of me
		set msgs to msgs & _name & " | "
		-- Subject
		set msgs to msgs & subject of _msg
		if read status of _msg is false then set msgs to msgs & ""
	end tell
	return msgs
end formatMsg

on toWidth(_str, _w)
	set _r to ""
	repeat with _a from 1 to _w
		try
			set _r to _r & character _a of _str
		on error
			set _r to _r & " "
		end try
	end repeat
	return _r
end toWidth

on replaceText(find, replace, someText)
	set prevTIDs to text item delimiters of AppleScript
	set text item delimiters of AppleScript to find
	set someText to text items of someText
	set text item delimiters of AppleScript to replace
	set someText to "" & someText
	set text item delimiters of AppleScript to prevTIDs
	return someText
end replaceText

on parseName(_str)
	set predelim to AppleScript's text item delimiters
	set AppleScript's text item delimiters to " <"
	set _items to text items of _str
	set AppleScript's text item delimiters to predelim
	set _name to item 1 of _items
	set _name to replaceText("\"", "", _name) of me
	set _name to replaceText("<", "", _name) of me
	set _name to replaceText(">", "", _name) of me
	return _name
end parseName

on formattedDate(_date)
	set _date to _date
	set {_y, _m, _d} to {year of _date, month of _date as number, day of _date}
	if _m < 10 then set _m to "0" & _m
	if _d < 10 then set _d to "0" & _d
	return _y & "-" & _m & "-" & _d & "| "
end formattedDate
eos
See my previous posts about using escaped characters for the extra coloring.
 

Attachments

  • geektool-inbox3.png
    geektool-inbox3.png
    106 KB · Views: 104
Status
Not open for further replies.
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.