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've searched high and low for a way to make a changing image for signal strength, but to no avail. Can you offer any info?

I did it with applescript, I've putted 2 applescripts together.
what it does:
It tries to get the name of the current network if there's non then return "Airport Power off"
when you're connected it retrieves the signal strength and calculates its to a scale of 3. (because I only use 3 images + 1 when airport power is off or none available). Depending on the result the script will move the corresponding image to a folder and move the non belonging image back to the others.
whats left to do for you is to open geektool drag and drop 2 geeklets: shell and image
at shell, goes the link to the script and the image, is the path to your folder where the image can be found.

thats all.

If you want, I can post the script then you'll just have to change some paths (2 in total) XD
 
Is there any way to make it so that the color of the text in a script changes based on it's parameters?
For example, I have a battery script that shows the percentage remaining.
I'm hoping for something along the lines of:
- 01% -> 20% = red text
- 21% -> 94% = black text
- 95% -> 100% = green text

Anyone know if this is possible? It isn't imperative that I have it but I thought it would make for a nice feature. I know that it would call for an if/then statement, but I lack all knowledge of unix or ruby.
 
great weather pic commands

I created a 'shell' that gets the weather picture:

curl --silent "http://weather.yahoo.com/spain/valencia/elx-759880/" | grep "forecast-icon" | sed "s/.*background\:url(\'\(.*\)\')\;\ _background.*/\1/" | xargs curl --silent -o /var/tmp/weather_test.pngxargs curl --silent -o /var/tmp/weather.png

An then an 'image' that displays the weather picture on the desktop

file://localhost/var/tmp/weather.png

You will need to change the URL (http://weather.yahoo.com/spain/valencia/elx-759880/) so that it gets weather in your location.

This works very well thank you!
 
quote

anyone find a working quote shells to replace encarta? i used to separate the quote with the author's name and put the authors name under the quote.
 
Can't get the weather in Haarlem to work..

2009-12-14_2351-1.jpg


But I can live with the widget instead I guess
 
Here is my current geektool setup click here

geektools enabled;
- date, time, weekday, ...
- current weather from yahoo
- quote of the day
- amount of unread mail messages
- current local IP
- Airport status with changing images for signal-strength and location

most script are self made using applescript or unix.
most of the time I use both applescript and unix together

other and current disabled scripts are;
- icalevents (with some bugs)
- calendar (with the current date in other color so that you'll notice
- itunes current track
- current song on the radio
- total, current network traffic
- todo's
- disk size of every mounted disk/volume and trash size

thats about it

Any chance you'd be willing to help with your scripts?

I.e. QOTD..
 
Any chance you'd be willing to help with your scripts?

I.e. QOTD..

No problem, here it is.

drag'n'drop a shell geeklet and type following;
osascript /Users/yourname/Documents/geektool/kwoot.scpt
(if you want to now the path to the script and drag'n'drop in Terminal)

the actual script is below (copy and paste in applescript editor and save)

Code:
tell application "Finder"
	
	set AppleScript's text item delimiters to ""

	set tekst to every paragraph of (do shell script "curl " & "\"" & "feeds.feedburner.com/brainyquote/QUOTEBR" & "\"")
	
	set auteur to item 21 of tekst
	set kwoot to item 22 of tekst
	
	set AppleScript's text item delimiters to ">"
	set auteur to text item 2 of auteur
	set AppleScript's text item delimiters to "<"
	set auteur to text item 1 of auteur
	
	set AppleScript's text item delimiters to "\""
	set kwoot to text item 2 of kwoot
	
	set kwoot to auteur & return & kwoot
	set AppleScript's text item delimiters to ""
	return kwoot
	
end tell

It may look very poor written, but i had to study/create it myself
(it works on both Leopard as snow Leopard) previous OS versions I haven't tested but I assume they do just fine
 
But I can live with the widget instead I guess

Your weather script won't work.
Do you have some special network settings, like a proxy setting, ...

I can try to help if you like too
haarlem? where is it located? Netherlands? Belgium? Germany?
 
Your weather script won't work.
Do you have some special network settings, like a proxy setting, ...

I can try to help if you like too
haarlem? where is it located? Netherlands? Belgium? Germany?

he means "Harlem" in manhattan (new york city)
 
Here is my current geektool setup click here

geektools enabled;
- date, time, weekday, ...
- current weather from yahoo
- quote of the day
- amount of unread mail messages
- current local IP
- Airport status with changing images for signal-strength and location

most script are self made using applescript or unix.
most of the time I use both applescript and unix together

other and current disabled scripts are;
- icalevents (with some bugs)
- calendar (with the current date in other color so that you'll notice
- itunes current track
- current song on the radio
- total, current network traffic
- todo's
- disk size of every mounted disk/volume and trash size

thats about it

Very cool!
 
wallpaper link and location comment

wallpaper link please

Mostly from interface lift or from usingmac. That one in particular is right here.

And Tomge, you assumed correctly that I'm looking for the weather for 'old Eurozone' Haarlem in the Netherlands, as opposed to the New York Harlem - it just happens that the New York skyline is marginally more interesting than the 'original' Haarlem, wallpaper-wise. Well, you can be the judge of that:

633068-Haarlem-Haarlem.jpg


For the weather I've tried various script options with Lynx and wunderground but nothing works.
 
Mostly from interface lift or from usingmac. That one in particular is right here.

And Tomge, you assumed correctly that I'm looking for the weather for 'old Eurozone' Haarlem in the Netherlands, as opposed to the New York Harlem - it just happens that the New York skyline is marginally more interesting than the 'original' Haarlem, wallpaper-wise. Well, you can be the judge of that:



For the weather I've tried various script options with Lynx and wunderground but nothing works.


and i thought it was new york...oooh well i tried to help
 
Hi
just a simple question I hope you guys can help me with,
having finished my festive Simpsons geektool DT, as my very first project, I was wondering, is it possible for me to start on a new project and not interfere with my current set up.?/

I'm using geektool 3, and if it is possible, can anyone just let me know how to kick off a new one.

cheers

toz
 
Hi
just a simple question I hope you guys can help me with,
having finished my festive Simpsons geektool DT, as my very first project, I was wondering, is it possible for me to start on a new project and not interfere with my current set up.?/

I'm using geektool 3, and if it is possible, can anyone just let me know how to kick off a new one.

cheers

toz
In GT. 3 you can create groups, and each item is assigned to a group. Only one group can be active at a time. So, put all of the new project in a new group name.
 
For the weather I've tried various script options with Lynx and wunderground but nothing works.

Works for me for Haarlem - just remember to keep the refresh to an hour or slower so that Yahoo does not block your connection.

Current Conditions - Fahrenheit
Code:
curl "http://weather.yahooapis.com/forecastrss?p=NLXX0010&u=f" | grep -E '(Current Conditions:|F<BR)' | sed -e 's/Current Conditions://' -e 's/<br \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/<description>//' -e 's/<\/description>//'

Current Conditions - Celsius
Code:
curl "http://weather.yahooapis.com/forecastrss?p=NLXX0010&u=c" | grep -E '(Current Conditions:|C<BR)' | sed -e 's/Current Conditions://' -e 's/<br \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/<description>//' -e 's/<\/description>//'


Forecast Conditions - Fahrenheit
Code:
curl  "http://weather.yahooapis.com/forecastrss?p=NLXX0010&u=f" | grep -e "Forecast:" -A 2 | tail -n 2 | sed -e 's/<br \/>//' -e 's/<BR \/>//' | sed "s/\(.*\)\.\ \(.*\)/\1\?\2/" | tr "?" "\n" | sed "s/High\:\ \(.*\)\ Low\:\ \(.*\)/\?H\: \1\  L\:\ \2/" | sed "s/\?\(.*\)/\\1/"

Forecast Conditions - Celsius
Code:
curl  "http://weather.yahooapis.com/forecastrss?p=NLXX0010&u=c" | grep -e "Forecast:" -A 2 | tail -n 2 | sed -e 's/<br \/>//' -e 's/<BR \/>//' | sed "s/\(.*\)\.\ \(.*\)/\1\?\2/" | tr "?" "\n" | sed "s/High\:\ \(.*\)\ Low\:\ \(.*\)/\?H\: \1\  L\:\ \2/" | sed "s/\?\(.*\)/\\1/"

Image Grabber
Code:
curl --silent "http://weather.yahoo.com/netherlands/north-holland/haarlem-729636" | grep "forecast-icon" | sed "s/.*background\:url(\'\(.*\)\')\;\ _background.*/\1/" | xargs curl --silent -o /var/tmp/weather_image.png\

Image Display
Code:
file://localhost/var/tmp/weather_image.png
 
Works for me for Haarlem - just remember to keep the refresh to an hour or slower so that Yahoo does not block your connection.

Current Conditions - Fahrenheit
Code:
curl "http://weather.yahooapis.com/forecastrss?p=NLXX0010&u=f" | grep -E '(Current Conditions:|F<BR)' | sed -e 's/Current Conditions://' -e 's/<br \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/<description>//' -e 's/<\/description>//'

Current Conditions - Celsius
Code:
curl "http://weather.yahooapis.com/forecastrss?p=NLXX0010&u=c" | grep -E '(Current Conditions:|C<BR)' | sed -e 's/Current Conditions://' -e 's/<br \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/<description>//' -e 's/<\/description>//'


Forecast Conditions - Fahrenheit
Code:
curl  "http://weather.yahooapis.com/forecastrss?p=NLXX0010&u=f" | grep -e "Forecast:" -A 2 | tail -n 2 | sed -e 's/<br \/>//' -e 's/<BR \/>//' | sed "s/\(.*\)\.\ \(.*\)/\1\?\2/" | tr "?" "\n" | sed "s/High\:\ \(.*\)\ Low\:\ \(.*\)/\?H\: \1\  L\:\ \2/" | sed "s/\?\(.*\)/\\1/"

Forecast Conditions - Celsius
Code:
curl  "http://weather.yahooapis.com/forecastrss?p=NLXX0010&u=c" | grep -e "Forecast:" -A 2 | tail -n 2 | sed -e 's/<br \/>//' -e 's/<BR \/>//' | sed "s/\(.*\)\.\ \(.*\)/\1\?\2/" | tr "?" "\n" | sed "s/High\:\ \(.*\)\ Low\:\ \(.*\)/\?H\: \1\  L\:\ \2/" | sed "s/\?\(.*\)/\\1/"

Image Grabber
Code:
curl --silent "http://weather.yahoo.com/netherlands/north-holland/haarlem-729636" | grep "forecast-icon" | sed "s/.*background\:url(\'\(.*\)\')\;\ _background.*/\1/" | xargs curl --silent -o /var/tmp/weather_image.png\

Image Display
Code:
file://localhost/var/tmp/weather_image.png

Thanks for that RogersDA, that finally worked for me:

weather2009-12-1607-33-29.jpg
 
That would really make my day. Thanks!

Here it goes,

Code:
tell application "Finder"
	set AppleScript's text item delimiters to ""
	set power to every paragraph of (do shell script "networksetup -getairportpower Airport Extreme")
	
	if (power as string) contains "On" then
		set airport to do shell script "networksetup -getairportnetwork Airport Extreme"
		set AppleScript's text item delimiters to ": "
		set airport to text item 2 of airport as string
		set AppleScript's text item delimiters to ""
	else
		set airport to "Aiport Power Off"
	end if
	
	-- display signal strength
	set strength_curfolder to "mac hd:users:tom:documents:geektool:airport strength:current"
	set strength_pngfolder to "mac hd:users:tom:documents:geektool:airport strength"
	
	set AppleScript's text item delimiters to ""
	set strength to (do shell script "/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport --getinfo")
	
	if (count of every paragraph of (strength as string)) is greater than 2 then
		
		set strength to paragraph 1 of (strength as string)
		
		set AppleScript's text item delimiters to "-"
		set strength to text item 2 of strength
		set AppleScript's text item delimiters to ""
		
		
		set strength_percent to character 1 of (((strength / 96) * 3) as string)
		
		
		--	display dialog ((strength / 96) * 3)
		if (name of item 1 of folder strength_curfolder) as string is not equal to ((strength_percent as string) & ".png") then
			move item 1 of folder strength_curfolder to folder strength_pngfolder
			move item (strength_pngfolder & ":" & (strength_percent as string) & ".png") to folder strength_curfolder
		end if
	else
		if (name of item 1 of folder strength_curfolder) as string is not equal to ("00.png") then
			move item 1 of folder strength_curfolder to folder strength_pngfolder
			move item (strength_pngfolder & ":" & ("00.png")) to folder strength_curfolder
		end if
		
	end if
	
	--data voor geektool
	return airport
	
end tell

You need to change following paths in the applescript
1. strength_curfolder (this one goes to the folder with current image to be displayed)
2. strength_pngfolder (this one goes to the folder where all the images are located)

Geektool,
shell geeklet: osascript (unix path to script)
image geeklet: path to current image folder (not the image itself but just the folder where it's in)
example: in geektool you should see something like this "file://localhost/Users/tom/Documents/geektool/airport strength/current/"

What's your scale of displaying the current airport strength?
mine is 3 this means, I have 3 bars that will change according to the signal.
I only use the first character from my calculation so my files name are like this,
0.png (1 stripe), 1.png (2 stripes), 2.png (3 stripes (=good signal)), 00.png (0 stripes)
If you want an example you can check out my geektool setup

if you have questions then I'll be glad to answer
enjoy
 
word clock

So messing around with a new layout today i felt inspired by http://www.qlocktwo.com/info.php?lang=en. so i created a simple ruby script, and using two shells got the effect i wanted.

the script can take 2 arguments -a (which displays the background text, ie what time it is not) and -n (which displays the string without the space after each letter. in the attached screenshots i have:
shell 1 (background):
ruby wordclock.rb -a
shell 2 (time):
ruby wordclock.rb

i wrote this up pretty quick so if someone wants to refine it go ahead

Code:
require 'date'

now = DateTime.now
hour = now.hour
minute = now.min
minutes = [
  "           \n           \n           \n       ",
  "           \n      FIVE \n           \nPAST   ",
  "           \n           \n    TEN    \nPAST   ",
  "A QUARTER  \n           \n           \nPAST   ",
  "           \nTWENTY     \n           \nPAST   ",
  "           \nTWENTYFIVE \n           \nPAST   ",
  "           \n           \nHALF       \nPAST   ",
  "           \nTWENTYFIVE \n         TO\n       ",
  "           \nTWENTY     \n         TO\n       ",
  "A QUARTER  \n           \n       OF  \n       ",
  "           \n           \n    TEN  TO\n       ",
  "           \n      FIVE \n       OF  \n       "
  ]

hours = [
   "    \n           \n           \n           \n     TWELVE\n     ",
   "    \nONE        \n           \n           \n           \n     ",
   "    \n           \n        TWO\n           \n           \n     ",
   "    \n      THREE\n           \n           \n           \n     ",
   "    \n           \nFOUR       \n           \n           \n     ",
   "    \n           \n    FIVE   \n           \n           \n     ",
   "    \n   SIX     \n           \n           \n           \n     ",
   "    \n           \n           \n           \nSEVEN      \n     ",
   "    \n           \n           \nEIGHT      \n           \n     ",
   "NINE\n           \n           \n           \n           \n     ",
   "    \n           \n           \n           \n           \nTEN  ",
   "    \n           \n           \n     ELEVEN\n           \n     ",
   "    \n           \n           \n           \n     TWELVE\n     "
   
   ]

output = "IT IS      \n"
output+= minutes[minute/5]

hour -=12 if hour > 12 #convert from 24hours format

if(minute >= 35)
  if(hour == 12)
    hour = 1
  else
    hour +=  1
  end
end


output+= hours[hour]
output+="OCLOCK" if minute/5 == 0

if(ARGV.include?("-a") || ARGV.include?("-an") || ARGV.include?("-na"))
  antistring = "ITLISASTIME\nACQUARTERDC\nTWENTYFIVEX\nHALFTENOFTO\nPASTERUNINE\nONESIXTHREE\nFOURFIVETWO\nEIGHTELEVEN\nSEVENTWELVE\nTENSEOCLOCK"
  (0..output.length-1).each { |i| antistring[i] = (output[i] == ?\s || output[i]==?\n) ? antistring[i]:?\s }
  
  if(ARGV.include?("-n") || ARGV.include?("-an") || ARGV.include?("-na"))
    puts antistring
  else
    antistring.each_byte { | l |   print l.chr +  (l==?\n ? "" : " ") }
  end
elsif(ARGV.include?("-n"))
  puts output
elsif(ARGV.length > 0)
  printf "Not valid use:\n\n -a to display the 'anti-string'\n -n display the string without spaces\n"
else
  output.each_byte { | l |   print l.chr +  (l==?\n ? "" : " ") }
end
 

Attachments

  • wordclock.jpg
    wordclock.jpg
    16.6 KB · Views: 2,746
Status
Not open for further replies.
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.