Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

GeekTool - Useful and fun info on the desktop Pick of the Week
GeekTool iconThe macosxhints Rating:
8 of 10
[Score: 8 out of 10]
I've been playing with GeekTool for a few weeks now, and the more I use it, the more fun I'm having with it. We've run a couple of hints involving GeekTool (cal output on the desktop and today's iTunes song title in the menubar hint), but I felt it was worth a PotW as well.

What is GeekTool? A simple description would be it's a program (technically, it's a preference pane) that allows the output of a Unix command, the contents of a file, or an image from the web or your hard drive to be displayed on your screen. These commands and images can be updated on varying schedules that you can set for each item. Within that simple description, though, there are a ton of possibilities. Here's a simple example of some of what you can do (click the image for a larger version):


I've got five separate GeekTool tasks running in the above image. At the very bottom of the screen, the output of the uptime command is displayed, and it updates automatically every 15 minutes. In the left corner is a calendar, courtesy of the cal command (as discussed in the linked hint above). The calendar output is only updated once per day. To the right of the calendar is a three-month Apple stock chart, updated every five minutes. The top left image is the Portland Doppler radar, which gets refreshed every 10 minutes, and to the right of that is an infrared image of the sun, updated every four hours. And no, I don't normally devote this much screen space to GeekTool toys; my usual set is just the uptime display, cal output, and (on interesting weather days) the weather map.

GeekTool's interface is a bit confusing and can be somewhat daunting to understand, but it gets easier the more you use it. You create new entries in groups, and then assign a task (display a file, output from a shell command, or show an image) to that entry. Each of the types of GeekTool tasks has its own settings, along with universal options for update interval, window size, position, color, and (if applicable) text. You can even specify any window as an "always on top" window, in which case it will float over all other OS X objects (including the dock).

Entering the update intervals is more difficult than it need be. The only time interval allowed is seconds, which makes for lots of math when you want to update something twice a day, once a week, once a month, etc. A better solution would be a numeric entry box and a pop-up menu for choosing between seconds, minutes, hours, etc.

Once a task has been created, you can move and size its window by either entering the data in the Location portion of the input screen, or by dragging and stretching its window with the mouse -- just make sure you select the task in the Groups window first.

Going into a ton of detail on everything you could do with GeekTool will take more time than I have available. Probably the best thing to do is to download it and start playing with it. Start with a live update image or the display of a file's contents, as those are probably the easiest two tasks to create. If you're comfortable with those tasks, try a simple shell command -- uptime or ls -l, just to see how it works. Note that GeekTool displays the output of a command after it has been run and terminated; hence, it won't display the output from top, since that's an interactive process. But you can have it display the output from top -l 1, since that just runs once then exits.

Given the shell's ability to run AppleScripts, the Shell tasks are by far the most powerful options in GeekTool. You can see an example of that in the iTunes hint linked above ... and if you're a GeekTool power user and have a favorite shell task, feel free to post it here in the comments!
    •    
  • Currently 1.50 / 5
  You rated: 1 / 5 (10 votes cast)
 
[98,494 views]  

GeekTool - Useful and fun info on the desktop | 72 comments | Create New Account
Click here to return to the 'GeekTool - Useful and fun info on the desktop' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
GeekTool - Useful and fun info on the desktop
Authored by: agallisa on Jul 07, '04 02:05:38AM

I would love to see a way to display the 5 latest subjects and to: from my mail with this tool. Kind of like mail notify does or mail bezel in konfabulator.



[ Reply to This | # ]
GeekTool - Useful and fun info on the desktop
Authored by: ybizeul on Jul 07, '04 04:12:56AM

Thank you guys for this article, this will motivate me to start working on GT3 :-)

There should ba a way to do what you want with Mail.app using AppleScript in geektool, just like the iTunes tip.



[ Reply to This | # ]
GeekTool - Useful and fun info on the desktop
Authored by: avarame on Jul 07, '04 03:03:13PM

Try Stattoo, from panic.com. Much less flexible, but it has a handful of default plugins, including one for Mail.app.



[ Reply to This | # ]
GeekTool - Useful and fun info on the desktop
Authored by: wah on Jul 07, '04 03:11:30PM

Does anyone know how to display mail's dock icon?



[ Reply to This | # ]
GeekTool - Useful and fun info on the desktop
Authored by: acm7110 on Jul 07, '04 10:38:19PM
Try this: http://www.bronsonbeta.com/mailappetizer/

[ Reply to This | # ]
GeekTool - Useful and fun info on the desktop
Authored by: wah on Jul 08, '04 01:55:59PM

Thanks. nice little plug-in. But what I'd like to figure out is how to display mail's numbered dock icon (or any image for that matter) at desktop level when I have unread messages.



[ Reply to This | # ]
GeekTool - Useful and fun info on the desktop
Authored by: Eravau on Jul 08, '04 06:37:24PM
All I did was create a one-line AppleScript in a text file and called it unread_mail_count. Inside of it was:
   tell application "Mail" to set need_to_read to unread count of mailbox "your_mailbox_name" of account "your_account_name"
Then from GeekTool I added a shell "log" with the file path osascript /full/path/to/unread_mail_count

After that, it's just setting up the GeekTool window with the font, color, placement, etc. that you want.


[ Reply to This | # ]
GeekTool - Useful and fun info on the desktop
Authored by: acm7110 on Jul 21, '04 02:23:34PM

I Need Help:

I wish display in my desktop my To Do items from iCal, categorized for calendar and due date.

Are there an Appla Script & Geek Tool to make that possible???

TIA



[ Reply to This | # ]
Backdrop Folders
Authored by: dperetti on Jul 07, '04 04:21:40AM
If you like to have stuff at the desktop level, you should love Backdrop Folders :

http://www.lachoseinteractive.net/en/products/backdropfolders.

It keeps "open views" of your favorite folders at the desktop level, that you can interact with.
It's Exposé friendly, you can save workspaces, customize the views globally and individually, and it implements Panther's kernel notification mechanism, so your views are always in sync (even after a file change from the Terminal).

[ Reply to This | # ]
Backdrop Folders
Authored by: dontlikehippies on Dec 10, '04 12:24:27AM

slightly reminiscent of windoze 3.11



[ Reply to This | # ]
GeekTool - Useful and fun info on the desktop
Authored by: GalainHH on Jul 07, '04 05:54:38AM

Does anybody know, how to Display a particular piece of the top output?

[code]top -l 1 | fgrep "CPU usage"[/code] displays the whole line, and additionally the idle value is wrong: it shows 0,0 %

I would like a display of a single value: current total CPU Usage.

Does anybody know the code?

GalainHH



[ Reply to This | # ]
GeekTool - Useful and fun info on the desktop
Authored by: chris_on_hints on Jul 07, '04 06:13:22AM

Can i suggest using MenuMeters? It does CPU, disk, network and memory useage in the menu bar... very nicely too.

sorry that i cant help with the 'top' command - grep just makes my head hurt!!



[ Reply to This | # ]
GeekTool - Useful and fun info on the desktop
Authored by: uff on Jul 07, '04 08:13:39AM

top -l 1 | fgrep "CPU usage" | awk '{print "cpu usage: ", $8}'
or $9 if you want the sys cpu usage%

[ Reply to This | # ]
GeekTool - Useful and fun info on the desktop
Authored by: robg on Jul 07, '04 08:15:29AM
This worked for me:
top -l 1 | grep 'CPU usage' | cut -c 33-80
The cut -c 33-80 bit displays only columns 33 to 80 of the grep result; 33 is where the phrase "CPU usage" starts, and 80 is about at the end of the line...

I tested with GeekTool, and it's working quite nicely -- though I do use MenuMeters, as suggested in another post...

-rob.

[ Reply to This | # ]
Does not work correctly
Authored by: GalainHH on Jul 08, '04 05:50:49AM
Thanks for the replies:

1) I can?t use another menubar item, my menubar is overcrowded: Meteorologist, ABMenu, Konfabulator, Timbuktu, Menu Calendar, Bluetooth PrefMenu, AppleScript Menu, Airport PrefMenu, Date and Time

I need a second Menubar!

Konfabulator has a widget, which makes the Job that Geektool should do in future, as I dont like Konfabulator and have only a demo Version runnig

2) top -l 1 | fgrep "CPU usage" | awk '{print "cpu usage: ", $8}'

Does only show the current User CPU Usage, not the sum of User and System Usage

3) top -l 1 | grep 'CPU usage' | cut -c 33-80

Shows 3 Values: The Idle Value is always 0,0, as the sum of User and CPU usage is always 100%

I think this is because top itself produces a high cpu usage, which is measured at the time, when invoked.

Sounds a bit confusing: A command, that shall display the CPU usage produces so much cpu load, that the result is falsified

GalainHH

[ Reply to This | # ]
Does not work correctly
Authored by: ToMaToTaChi on Jul 08, '04 06:48:28PM
just needs a slight modification :)
 top -dl2 | grep sage | cut -c 33-88 | tail -1 
Oh, but that wasn't good enough nope nope. :)

top -dl2 | grep "sage" | cut -c 44-71 | tail -1 | awk '{ printf "CPU Time\nUsed: %04.2f%%\nIdle: %04.2f%%\n", (100 - $5), $5; }'
Well, I liked that fine, it could be a little more fun
So:

top -dl2 | grep "sage" | cut -c 44-71 | tail -1 | awk '{
  pe = 30;
  pa = "[]";
  pb = "--";

  z[0] = 100 - $5;
  z[1] = $5;
  z[2] = "Used";
  z[3] = "Idle";

  for( foo = 0; foo < 2; foo++ )
  {
    zzz = ( pe * z[foo] / 100) + 0;
    zzy = ( pe - zzz) + 0;
    zza = "\000";
    zzb = "\000";
    
    for( bar = 0; bar < zzz; bar++ )
      { zza = zza pa }
    for( bar = 0; bar < zzy; bar++ )
      { zzb = zzb pb }
    printf "%s %04.2f%% %s%s\n", z[foo+2], z[foo], zza, zzb; 
  }
}'

note, geektool does not appreciate line brakes; strip them prior to pasting. I posted like this for the sake of legibility -- it's down right painful to read all clumped on a single line.

-- one thing that bummed me out was geektool did not like my echo -e \033[##m coloration, inversion, etc. I had the thing looking pretty spiffy in terminal.app running bash. Bah. all yellow and red, it's pretty :D

Otherwise i'm having too much fun with this thing!



[ Reply to This | # ]
Exactly what I wanted
Authored by: GalainHH on Jul 09, '04 02:47:27AM

Thanks a lot,

your second code line does exactly what I wanted.

Thank you
GalainHH



[ Reply to This | # ]
Does not work correctly
Authored by: Eravau on Jul 08, '04 06:50:12PM
To get around the "top always being the process hog" problem, I have my script run top with two samples. By the second sample, top has generally calmed down a little and isn't being the processor hog that it always is on launch. My script spits out the Uptime, Current Load Average, Total CPU Use (user + system), and the current CPU Hog Process. Take it and modify to taste:

#!/usr/bin/perl

$top_cmd     = "top -o cpu -l 2 -s 3 -n 1";
$uptime_cmd  = "uptime";
@top         = `$top_cmd`;
$uptime      = `$uptime_cmd`;

$count = scalar @top;

foreach $line_no (10..$count) {
        $line     = $top[$line_no];
        if ($line =~ /Load Avg.\s+(\d+\.\d+)\,\s+(\d+\.\d+)\,\s+(\d+\.\d+)\s+CPU usage.\s+(\d+\.\d+)\% user,\s+(\d+\.\d+)\% sys,\s+(\d+\.\d+)\% idle/) {
                $load_avg = $1;
                $load_rec = $2;
                $load_now = $3;
                $cpu_usr  = $4;
                $cpu_sys  = $5;
                $cpu_idl  = $6;
                $cpu_use  = $cpu_usr + $cpu_sys;
        }
        elsif ($line =~ /PID/) {
                $find_hog = 1;
        }
        elsif ($find_hog) {
                if ($line =~ /\s?\d+\s+(\S+(\s\S+)?)\s+(\d+.\d+)\S\s+\d+.\d\d.\d+/) {
                        $cpu_hog_name = $1;
                        $cpu_hog_prct = $3;
                }
        }
}
if ($uptime =~ /up\s+(\d+)\sday[s]?.\s+(\d+).(\d\d).\s+\d\susers/) {
        $days_up      = $1;
        $hours_up     = $2;
        $mins_up      = $3;
        $formatted_up = $days_up . "d:" . $hours_up . "h:" . $mins_up . "m";
}

print "Up Time:         $formatted_up\n";
print "Current Load:    $load_now\n";
print "Total CPU Use:   $cpu_use\%\n";
print "CPU Hog Process: $cpu_hog_name \@ $cpu_hog_prct\%\n";

exit;
There are a few other variables in there if you'd like to pull those out and display them as well. I just didn't really want to see them myself.

[ Reply to This | # ]
GeekTool - Useful and fun info on the desktop
Authored by: webbix on Jul 07, '04 11:55:08AM
I display the uptime info as noted in the top right corner
just under the menu bar which gives your averages
11:49 up 19:14, 1 user, load averages: 1.70 1.76 1.80
and use menumeters to display dynamic percentage of use.

I also run a command to display active connections:
netstat -ab -f inet | grep -i established | sort +4

[ Reply to This | # ]
what do you display?
Authored by: da5idonimac on Jul 07, '04 01:46:39PM

i have console.log and system.log showing through geektools. has helped me more than once. also, i display 2 german weather maps (i live in germany, that's why): one radar and one outlook.

i used to have more, like internet traffic stats, stock quotes, etc. but i realized i hardly use them and i couldn't see my fabulous background images anymore.

maybe i will use "cal" in future... any other good ideas?

oh, i almost forgot: i have multiple desktops. one "curl"s the news-page of my department at college and formats it a little, so i dont have to visit the website all the tiem to see what's new.



[ Reply to This | # ]
GeekTool Likes to Hide
Authored by: Malacoda on Jul 07, '04 04:16:41PM

For some reason I can only see the GeekTool windows when the pref pane is open. Close the pane or Preferences and they go away. I have tried any number of things to no avail (and yes, that includes making sure it is enabled!)

Anyone know what's up?



[ Reply to This | # ]
GeekTool Likes to Hide
Authored by: ferret-slayer on Jul 08, '04 01:28:43AM

If you find that GeekTools likes to hide when the PrefPane is not open, switch from Thousands to Millions of Colors.

The Help file says GeekTool doesn't like Thousands of Colors, and this turns out to be why.



[ Reply to This | # ]
GeekTool Likes to Hide
Authored by: Malacoda on Jul 08, '04 12:51:54PM

You're right, it is a color issue. I thought I had switched it to millions of colors, as per the help, but appearently my mind is going! I wish it worked at thousands of colors, though, as I find I get slightly better windowing performance with thousands (or maybe its all in my head).

Thanks for the reminder.



[ Reply to This | # ]
expose?
Authored by: djhayn on Jul 08, '04 01:22:59PM

is there any way around the fact that running an applescript kills expose's show desktop?

for example i wrote an itunes script for GeekTool and it updates every 10 seconds, if i press F11 and don't do anything else when the script runs again all my windows snap back. It doesnt happen with expose's other features (F9 and F10) so I'm confused.

this is also one of my first attempts at applescript so might be my fault, anyone else have the same problem?



[ Reply to This | # ]
GeekTool Likes to Hide
Authored by: bluehz on Jul 09, '04 02:42:23AM

Still not working on my machine unles prefpane is open and YES I do have it set to millions of colours.



[ Reply to This | # ]
GeekTool Likes to Hide
Authored by: maddys_daddy on Jul 08, '04 01:34:18AM

Forgive me for checking the obvious, but do you have other windows open while playing with geektool (e.g. Safari or something)? If so, minimize all windows and see if your geektool things are there. If "Always on top" is not checked in the geektool prefpane, then they will drop to the bottom (under the other windows) when the prefpane is closed. Just a thought...



[ Reply to This | # ]
GeekTool - Ideas of using it
Authored by: Gfx on Jul 07, '04 05:01:04PM

Beside using it to display some log files and uptime, I also use it to monitor the availability of the different servers (POP3, Mail, HTTP, etc) I need to be up all the time. When all "lights" are green then everything is ok, if a light turns red then I need to check that particular server.

I also use it to display my external IP (I have a router and my IP is dynamic) so I can have it handy all the time.

I'm still looking for other useful stuff thatI could do with it. Anyone has more tricks/ideas?



[ Reply to This | # ]
GeekTool - Ideas of using it
Authored by: maddys_daddy on Jul 07, '04 06:27:23PM

What command do you use to display your external IP? Is it ifconfig? If so, what command line options do you supply? I couldn't get ifconfig to do this for me, which is why I'm asking.



[ Reply to This | # ]
GeekTool - Ideas of using it
Authored by: Gfx on Jul 07, '04 09:55:41PM
To get your external IP when using a router, you need to get it from outside (a few websites provides such a service) or use your access to your router (much harder to simply get only the IP).

This is the code I use to get my external IP:

curl -s http://checkip.dyndns.org/ | sed 's/[a-zA-Z<>/ :]//g'
It would be also possible to make a little script to use the output of http://www.showmyip.com/simple/ but remember that they limit you to 300 requests per day.

I hope this helps.

[ Reply to This | # ]

GeekTool - Ideas of using it
Authored by: mrchaotica on Jul 09, '04 01:42:23AM

I've made myself a little shell script to show me useful status information (date, quote-of-the-day, battery charge, uptime, CPU temperature, disk usage, and now external IP (thanks Gfx!))

Note that battery status and CPU temp use external programs, and I'm not sure if they're redistributable - I'm pretty sure I grabbed them out of some Konfabulator widgets or something, if you want to try to find them. Also, QOTD just reads a file that I created by calling fortune in a cron job, so set that up if you want to use it.

Anyway, here's the script:

#!/bin/sh

# Jack's Ultimate Status Script
# Prints battery status, uptime, CPU temperature,
# time and date, external IP, disk usage, and QOTD

# input escape characters in emacs with ctrl-q <esc>

date
echo Quote of the Day:
echo `cat ~/QOTD` 
#/usr/local/bin/battery 
BATT=$(/usr/local/bin/battery compact | awk '{print $4 " " $9}')
BATT1=$(echo $BATT | awk '{print $1}')
BATT2=$(echo $BATT | awk '{print $2}')
BATT2INT=` echo $BATT2 | sed s/\..$//g `
if [ $BATT1 -eq 00000111 ]; then
	echo Battery charge: ${BATT2}%  \[charging\]
else
    if (( $BATT2INT < 20 )); then
	echo Battery charge: ${BATT2}%
    elif (( 20 < $BATT2INT < 50 )); then
	echo Battery charge: ${BATT2}%
    else
	echo Battery charge: ${BATT2}%
    fi
fi


#PRINT UPTIME
UPTIME=$(uptime)
UPDAY=$(echo $UPTIME | awk '{ print $3 }')
UPHOUR=$(echo $UPTIME | awk '{ print $5 }' | sed s/:.*//g)
UPMIN=$(echo $UPTIME | awk '{ print $5 }' | sed s/.*://g | sed s/,//g)
echo Uptime: $UPDAY days, $UPHOUR hours, $UPMIN minutes

# PRINT CPU TEMPERATURE INFO
TEMP=`/usr/local/bin/tempSensor -f`
TEMPINT=` echo $TEMP | sed s/\..$//g `
if (( $TEMPINT > 140 )) ; then
    echo CPU Temp: $TEMP degrees Fahrenheit
elif (( 130 < $TEMPINT < 140 )) ; then
    echo CPU Temp: $TEMP degrees Fahrenheit
else
    echo CPU Temp: $TEMP degrees Fahrenheit
fi

#PRINT DISK USAGE INFO
df -h | grep disk0s9 | awk '{print "Macintosh HD:", $2, "total,", $3, 
"used,", $4, "remaining"}'

#PRINT EXTERNAL IP ADDRESS
echo External IP: `curl -s http://checkip.dyndns.org/ | sed 's/[a-zA-Z<>/ :]//g'`

exit 0

By the way, the little box characters are escape characters; they denote ANSI color escape codes, which don't work in GeekTool. The easiest thing would just be to delete them.



[ Reply to This | # ]
GeekTool - Ideas of using it
Authored by: gent99 on Jul 09, '04 08:01:21AM

i would like to use this script, but i don't have /usr/local/bin/battery and /usr/local/bin/tempSensor here

Where can i get those commands?



[ Reply to This | # ]
GeekTool - Ideas of using it
Authored by: cyberwraith on Jul 09, '04 11:55:37PM

I like the idea of the icons (green = up) for servers and such, I used ping x.x.x.x but that did not have the desired effect. Nor could I get the icons to appear, care to share your secret here?



[ Reply to This | # ]
GeekTool - Useful and fun info on the desktop
Authored by: maddys_daddy on Jul 08, '04 01:26:18AM

Yes, that helped. Thanks. Now if I could just figure out what all that gibberish actually does. Do you know of a good free (as in beer) resource for a shell scripting newbie to learn about all the hieroglyphics like those used in your command?
thanks!



[ Reply to This | # ]
GeekTool - Useful and fun info on the desktop
Authored by: maddys_daddy on Jul 08, '04 01:36:00AM

whoops. This was supposed to be a reply to the sub-thread above.



[ Reply to This | # ]
Input only in seconds?
Authored by: EddEdmondson on Jul 08, '04 05:30:42AM
Want to know how many seconds there are in a day without opening the calculator and working it out by hand?

Open Terminal.app and type units. Then follow the prompt to get output like
You have: 2 days
You want: seconds
* 172800
/ 5.787037e-06

The number after the multiplier is what you want. The one after '/' is just the reciprocal because for some results that's easier to use.

This works with all sorts of units - for example, the famous
You have: attoparsec/microfortnight
You want: inch/second
* 1.0043268
/ 0.99569184


[ Reply to This | # ]

GeekTool - Useful and fun info on the desktop
Authored by: bluehz on Jul 08, '04 09:43:34AM

geektool is great when it works.. unfortunately - at least for me... its use is sketchy at best. Using even the most basic defaults - I can only get some of the "widgets" to appear some of the time. There is no consitency - sometimes I can bring it back to life disabling and renabling in the PrefPane - but in general it has a mind of its own. I would live to be able to use it - but with its success rate running about 25% - I find it unusable. If anyone has any insight into getting it to work better - please post!



[ Reply to This | # ]
expose and buddypop
Authored by: djhayn on Jul 08, '04 01:47:11PM

also on that same site, buddypop is excellent, for 5 euros i bought it as soon as i tried it and the developer was helpful and responsive with a problem.

sorry for posting this twice, it got tucked away in the wrong spot:

is there any way around the fact that running an applescript kills expose's show desktop?

for example i wrote an itunes script for GeekTool and it updates every 10 seconds, if i press F11 and don't do anything else when the script runs again all my windows snap back. It doesnt happen with expose's other features (F9 and F10) so I'm confused.

this is also one of my first attempts at applescript so might be my fault, anyone else have the same problem?



[ Reply to This | # ]
expose and buddypop
Authored by: pascalpp on Jul 09, '04 01:04:23AM

i have this same problem, my itunes status applescript snaps all the windows back when it updates. i thought maybe it was specific to applescript, but i can trigger other applescripts (using quickeys) while in expose's show desktop mode and the windows stay out of view as they should. so i think it must have something to do with how geektool is calling the applescript. it doesn't happen when i disable the iTunes status script. i can even force my other geektool widgets to refresh and expose works fine.

it's particularly a bummer precisely because i'm using show desktop so much more now that i'm using geektool.

(god, do you ever feel like you're just dorking out too much? : )



[ Reply to This | # ]
Perl, fink and geektool
Authored by: niksie3 on Jul 08, '04 02:20:58PM

This (Extremely Ugly) piece of perl code shows how to keep track of a stock using GeekTool.

In order not to get into any fights with geektool the perl command should be rather explicit. This is what I use, modify accordingly: "perl -I/sw/lib/perl5/5.8.1 /Users/nkist/Documents/Coding/Ticker/Ticker.pl"


Making it keep track of 2+ stocks is left as an excersize for the reader.

===============================================
#!/usr/bin/perl
use lib '/sw/lib/perl5/5.8.1';
use LWP::Simple;
$Stock="AAPL"; #Configure this
$quan=5; #this too
$boughtAt=21; #end configuration
$theString= get("http://finance.yahoo.com/d/quotes.csv?s=$Stock&f=sl1d1t1c1ohgv&e=.csv");
die "Failed to get Stock Data" unless defined $theString;

$theString=~ s/\"//g;
@data = split(/,/, $theString);


$firstWorth=$quan*$boughtAt;
$price=sprintf "%.2f",@data[1];
$currentWorth=$quan*$price;
$change=sprintf "%.2f",@data[4];
$gain=$currentWorth-$firstWorth;
$currentWorth=sprintf "%.2f", $currentworth;
$gain=sprintf "%.2f", $gain;
$daygain=sprintf "%.2f", $quan*$change;

print "@data[0]\t \$$price \t$change\n";
print "Total \$$gain \t$daygain\n";
exit 0;



[ Reply to This | # ]
Perl, fink and geektool
Authored by: tinker on Jul 08, '04 03:18:41PM
Or just snag the stock chart from Yahoo, like this:

http://chart.yahoo.com/c/0b/k/kkd.gif

[ Reply to This | # ]

Perl, fink and geektool
Authored by: sfr79 on Sep 12, '04 10:40:57AM

Here's my updated attempt at the previous poster's script. I've added a quick way to put in your portfolio.

#!/usr/bin/perl
use lib '/sw/lib/perl5/5.8.1';
use LWP::Simple;
use Term::ANSIColor;

# This is where you enter your currently owned stocks in the following format:
# @Portfolio[0] = "Symbol,Shares,Buy Price";
# ex @Portfolio[0] = "AAPL,100,24.2";

@Portfolio[0] = "AAPL,100,24.2";

# For every stock in your portfolio, get the current info and
# calculate the change.
foreach $array_element(@Portfolio)
{
@info = split(/,/, $array_element);

# Historical Portfolio Info
$Stock = @info[0];
$quantity = @info[1];
$boughtAt = @info[2];
$firstWorth = $quantity * $boughtAt;

# Get Current Quote from Yahoo. Note the sl1d1t1c1ohgv
# part might have to be edited by going to yahoo's site
$theString = get("http://finance.yahoo.com/d/quotes.csv?s=$Stock&f=sl1d1t1c1ohgv&e=.csv");
die "Failed to get Stock Data" unless defined $theString;
$theString =~ s/\"//g; #"
@data = split(/,/, $theString);

# Current Quote Stats
$todayPrice = @data[1];
$todayWorth = $quantity * $todayPrice;
$todayChange = @data[4];

# Gain in stock price
$gain = $todayWorth - $firstWorth;
$todayGain = $quantity * $todayChange;

#Portfolio Info
$portfolioDayGain = $portfolioDayGain + $todayGain;
$portfolioGain = $portfolioGain + $gain;
$portfolioChange = $portfolioChange + $todayChange;
$portfolioFirstWorth = $portfolioFirstWorth + $firstWorth;
$portfolioCurrentWorth = $portfolioCurrentWorth + $todayWorth;

#Convert Numbers to 2 decimals
$gain = sprintf "%.2f", $gain;
$todayChange = sprintf "%.2f", $todayChange;
$todayPrice = sprintf "%.2f" , $todayPrice;
print "$Stock\t \$$todayPrice \t$todayChange\n";
#print "currWorth: $todayWorth\n";
#print "\tOverall: \$$gain \t$todayGain\n";
}

#print color 'bold';
$portfolioDayGain = sprintf "%.2f", $portfolioDayGain;
$portfolioGain = sprintf "%.2f", $portfolioGain;
$portfolioChange = sprintf "%.2f", $portfolioChange;

# Last Update
print "@data[2] @data[3]\n";
# Overall: TotalGain TodaysGain
print "Ovr: \$$portfolioGain \t$portfolioDayGain\n";

exit 0;



[ Reply to This | # ]
GeekTool - Useful and fun info on the desktop
Authored by: qramsay on Jul 08, '04 04:31:44PM
I really liked the iTunes in the menubar hint, and spiffied up the output a bit, using info from another hint as well. Here is what the output on the menubar looks like, if the artist and title are too long:

Bach - Mass in B Minor, BWV232, XVIII. Cho... | 4:19
or, if it all fits:

The Verve - The Drugs Don't Work | 5:02
The applescript:

on timeString(time)
    set minutes to time div 60
    set myseconds to (time - minutes * 60)
    if myseconds < 10 then
        set myseconds to "0" & myseconds
    end if
    set timeStr to minutes & ":" & myseconds
end timeString

tell application "iTunes"
    if player state is playing or player state is paused then
        set trkName to name of current track
        set trkPos to player position
        set trkTime to duration of current track
        set trkArt to artist of current track

        my timeString(trkTime - trkPos-1)
        set rem to result

        set display to trkArt & " - " & trkName & " | " & rem
    end if
end tell
My applescript is executed using this shell script, which keeps the remaining time displayed, even if the rest of the information is too long:

if ps x | grep iTunes | grep -q -v grep;   then
    export STR="`osascript iTunesName.scpt | iconv -f utf-8 -t ucs-2-internal`"
    LEN=${#STR}
    if [ "$LEN" -gt "53" ]
    then
        TMP=${STR%%|*}
        echo "${TMP:0:42}... |${STR#*|} " #I'd rather not hard-code it
    else
        echo $STR
    fi
fi
(I would welcome any cleaner suggestions, as I was trying to learn bash scripting via writing this script...) Now if only I knew how to get the text to scroll, without sucking up resources. This script is executed with GeekTool every second, and isn't too bad, but scrolling might cross the line.

---
Give a man a program, and frustrate him for a day;
teach a man to program, and frustrate him for the rest of his life.

[ Reply to This | # ]

GeekTool - Useful and fun info on the desktop
Authored by: Frederico on Jul 08, '04 08:59:08PM
I happen to like a fair amount of information displayed; this is a modified version of a script I've been using for awhile with straight AppleScript for use with GeekTool; the original brings up a dialog and option to edit the track when a specified field is empty and requires addressing. As I'm in the process of cataloging and defining 40 years of music, much of it from vinyl, into iTunes, it's quite handy to see a fair amount of info while I'm working (especially when stuck on the phone with a jabbering client). (:

Sample output:
'Slither' by 'Velvet Revolver' on '(single)' |
Rock | (please rate this track) | -2:49 of 4:16 | 
Free from Apple iTunes QT Videos
The script:
(*Display iTunes Info for GeekTool;  ©2004 by Frederico; frederico@mac.com *)
tell application "System Events"
	if exists process "iTunes" then
		tell application "iTunes"
			try	
				set {n, a, al, g, r, c, d, t} to ¬
					{name, artist, album, genre, rating, comment, duration, time} of current track
				set e to player position
				set rT to my doTime(d - e)
				if n is "" then set n to "(unknown name)"
				if a is "" then set a to "(unknown artist)"
				if al is "" then set al to "(unknown album)"
				if g is "" then set g to "(unknown genre)"
				if r is less than 20 then set rs to "(please rate this track)"
				if r is greater than 19 then set rs to "*"
				if r is greater than 39 then set rs to "* *"
				if r is greater than 59 then set rs to "* * *"
				if r is greater than 79 then set rs to "* * * *"
				if r is greater than 99 then set rs to "* * * * *"
				if c is "" then set c to "(no comment)"
				set displayInfo to "'" & n & "'" & " by " & "'" & a & "'" & " on " & "'" & al & "'" & ¬
					" | " & g & " | " & rs & " | " & "-" & rT & " of " & t & " | " & c
				
			on error errMSG number errnum
				log errMSG
				set displayInfo to "(iTunes Player is not playing)  " & "(" & errMSG & ")"
			end try
		end tell
	else
		set displayInfo to "(iTunes Player not running)"
	end if
	return displayInfo
end tell
on doTime(x)
	set m to x div 60
	set s to (x - m * 60)
	if s < 10 then set s to "0" & s
	return m & ":" & s
end doTime
HTH PS: Rob, I hope this isn't formatted too wide; I used AS carriage returns to squeeze it up a bit. -- F

[ Reply to This | # ]
GeekTool - Useful and fun info on the desktop
Authored by: zane on Jul 08, '04 05:44:48PM
This is a neat little prefpane - thanx rob for posting this, and kudos to Tynsoe.

This may seem pretty obvious and simple to most, but I just realized that with GeekTool you can make an excellent alternative to the Date & Time menulet if you want to reclaim some menu bar space.

I just ran a second instance of an uptime module, shrunk the window to 40x11, no-frame, always on top and placed it in the centre of my menu bar. Now I have a nice tiny little Monaco 9pt clock (no date), and about an inch of extra menu bar space.

Couple that with another uptime module on my desktop, and a cal module, and GeekTool has now become a permanent fixture of my daily working environment :D Now, what other geeky goodness can I get this thing to do...

[ Reply to This | # ]
GeekTool - Useful and fun info on the desktop
Authored by: zane on Jul 08, '04 06:43:55PM
Just added a date to the menu with another module, using the date command. Neat :)

Here's a screenshot

[ Reply to This | # ]
GeekTool - Useful and fun info on the desktop
Authored by: pascalpp on Jul 09, '04 01:40:45AM

you could do this with one module using the following command:

date "+%l:%m%n%a %b %e"

Set it to update every 60 seconds and tell GeekTool to center the text and it should look just like what you've got in your screenshot. this way you wouldn't have to run 2 uptime instances.

Type man strftime for more info on the date formatting codes used above.



[ Reply to This | # ]
GeekTool - Useful and fun info on the desktop
Authored by: windrag on Jul 20, '04 02:30:34AM
Should read:
date "+%l:%M%n%a %b %e"
Note uppercase "M" (for minutes) as opposed to lowercase "m" (for month) rag

---
Ryk A. Groetchen
700MHz iBook 16 VRAM G3
640MB RAM
OS X 10.3.2

[ Reply to This | # ]

GeekTool - Useful and fun info on the desktop
Authored by: zane on Dec 10, '04 03:33:55AM

6 months later, and I just noticed these replies. Nevertheless, excellento tips... even better. Thanks guys



[ Reply to This | # ]
GeekTool - Useful and fun info on the desktop
Authored by: adhesiv on Jul 09, '04 05:10:24AM
Here's my two cents on an iTunes script:


property go1 : false
-- check to see if iTunes is running
tell application "System Events"
	set the process_flag to (exists process "iTunes")
end tell
if the process_flag then
	-- check to see if iTunes is playing
	tell application "iTunes"
		if player state contains playing then set go1 to true
	end tell
	if go1 then
		-- do what you need to do
		tell application "iTunes"
			set foo1 to artist of current track
			set foo2 to name of current track
			set foo3 to "[" & foo1 & "]" & " / " & foo2
		end tell
	end if
end if


This code will check to see if iTunes is running, if it is it will also check to see if iTunes is playing before trying to display the playing track name. The problem with some of the previous scripts are that they would either start iTunes if it wasn't running or would spit out errors in the console.log if it wasn't currently playing any song. This checks everything before trying to move forward.

the format of the output looks like this:

[Velvet Revolver] / Slither

I like my output simple and on one line if possible. i don't need to know the album, time remaining, rating or other stuff, i just want to know who's playing and what they're playing. But it's easy to add more stuff to this script if you desire.

[ Reply to This | # ]
GeekTool - Useful and fun info on the desktop
Authored by: Frederico on Jul 09, '04 01:01:41PM

I see your point about Console entries, but your script will not indicate what song is selected in the Player if it is not playing; IOW, if Player is paused, you get no result in your GT display. With the script I posted above, it will always return the selected song info (if iTunes is running), unless you're in the Music Store playing a sample, video or similar, which does not return data; thus the error handler in the above script, which does not send any info to Console.

Cheers



[ Reply to This | # ]
GeekTool - Useful and fun info on the desktop
Authored by: adhesiv on Jul 09, '04 06:11:01PM

True, I guess you could add another chunk of code similar to the player state to reflect iTunes in paused or stopped(?) state. This would return data in those 3 scenarios which I believe are the only ones that would be used while iTunes is open.

Jayson



[ Reply to This | # ]
GeekTool - Useful and fun info on the desktop
Authored by: adhesiv on Jul 09, '04 09:47:06PM
I modified my script a little...ok a lot...the output of this will look like this:

[Staind]  :||:  Price to Play  :||:  3:11 / 3:41


the timer will adjust depending on the position of the track and updates in real time going from 0:00 to 3:41 (in this case)

It also checks to see if iTunes is playing, paused, stopped, rewinding, or fast forwarding and will output the track title regardless of the state the player is in. This was mentioned to me by Frederico (thanx!).


--iTunesTracker: Copyright 2000 - Jayson Cote

property go1 : false
-- check to see if iTunes is running
tell application "System Events"
	set the process_flag to (exists process "iTunes")
end tell
if the process_flag then
	tell application "iTunes"
		set d to duration of current track
		set e to player position
		set rT to my doTime(e)
	end tell
	-- check to see if iTunes is playing
	tell application "iTunes"
		if player state contains playing then set go1 to true
	end tell
	if go1 contains false then
		-- check to see if iTunes is paused
		tell application "iTunes"
			if player state contains paused then set go1 to true
		end tell
	end if
	if go1 contains false then
		-- check to see if iTunes is stopped
		tell application "iTunes"
			if player state contains stopped then set go1 to true
		end tell
	end if
	if go1 contains false then
		-- check to see if iTunes is rewinding
		tell application "iTunes"
			if player state contains rewinding then set go1 to true
		end tell
	end if
	if go1 contains false then
		-- check to see if iTunes is fast forwarding
		tell application "iTunes"
			if player state contains fast forwarding then set go1 to true
		end tell
	end if
	if go1 then
		-- do what you need to do
		tell application "iTunes"
			set foo1 to artist of current track
			set foo2 to name of current track
			set foo3 to time of current track
			set foo4 to rT & " / " & foo3
			set foo5 to "[" & foo1 & "]" & "  :||:  " & foo2 & "  :||:  " & foo4
		end tell
	end if
end if
on doTime(x)
	set m to x div 60
	set s to (x - m * 60)
	if s < 10 then set s to "0" & s
	return m & ":" & s
end doTime


[ Reply to This | # ]
GeekTool - Useful and fun info on the desktop
Authored by: Frederico on Jul 11, '04 04:35:45AM
I like that you've taken an extra step or three to look for additional Player states; and testing your script exposes some weaknesses in mine that I just wrapped entirely in one big error handler; something your script lacks and really needs. E.G., try this: open your script in Script Editor; observe the 'Event Log History'; open up the iTunes Music Store; find and play any sample; run your script:

tell application "System Events"
	exists process "iTunes"
		true
end tell
tell application "iTunes"
	get player state
		playing
	get duration of current track
	-->	"iTunes got an error: Can't get duration of current track."

Part of the problem is that you're asking iTunes to return information about song data before you even know the Player State; but, as the above test proves, even a player state check first, with streamlined code to reduce the excessive requests in your original check for Player State (i.e., if your Player is Fast Forwarding, your script makes five attempts to figure that out; too slow; taxes osascript and CPU cycles) followed by an info request can fail in certain states when the player is still Playing. Observe:


property go1 : false
-- check to see if iTunes is running
tell application "System Events"
	set the process_flag to (exists process "iTunes")
end tell
if the process_flag then
	tell application "iTunes"
		-- check to see if iTunes is playing
		set go1check to player state
		if go1check contains playing or go1check contains paused or go1check ¬
			contains stopped or go1check contains rewinding or go1check contains fast forwarding ¬
			then set go1 to true
	end tell
	if go1 then
		-- do what you need to do
		tell application "iTunes"
			set d to duration of current track
			set e to player position
			set rT to my doTime(e)
			set foo1 to artist of current track
			set foo2 to name of current track
			set foo3 to time of current track
			set foo4 to rT & " / " & foo3
			set foo5 to "[" & foo1 & "]" & "  :||:  " & foo2 & "  :||:  " & foo4
		end tell
	end if
end if
on doTime(x)
	set m to x div 60
	set s to (x - m * 60)
	if s < 10 then set s to "0" & s
	return m & ":" & s
end doTime
Result:

tell application "System Events"
	exists process "iTunes"
		true
end tell
tell application "iTunes"
	get duration of current track
		-->"iTunes got an error: Can't get duration of current track."
So, while we have a Player State that is Playing, and we could even meet any one of the other five states while in the Music Store, or other similar condition, we choke on duration. Try reordering the info calls, and you get some interesting results:

    -->"iTunes got an error: Can't get time of current track."
    -->"iTunes got an error: Can't get artist of current track."
    -->"iTunes got an error: Can't get duration of current track."
    -->"iTunes got an error: Can't get name of current track."
get player position
	-->	0
Interesting. So, with some logical deductions and some error handlers, we can probably, through testing various Player States, return more useful data to GeekTool. Now, I'm still using iTunes 4.1 and iTunes 4.5, and I think iTunes 4.6 actually deals with this better by allowing for more Shared Library and Music Store calls, plus you could probably get the current view of the browser to return more useful info, so I don't know how much effort its worth. That said, assuming they didn't, here's one iteration that not only streamlines your code more, but also handles at least the Music Store failure a bit more gracefully:

property go1 : false
-- check to see if iTunes is running
tell application "System Events"
	set the process_flag to (exists process "iTunes")
end tell
if the process_flag then
	tell application "iTunes"
		-- check to see if iTunes is playing
		set go1check to player state
		if go1check contains playing or go1check contains paused or go1check ¬
			contains stopped or go1check contains rewinding or go1check contains fast forwarding ¬
			then
			set go1 to true
		else
			return "iTunes Player State unknown"
		end if
		if go1 then
			-- do what you need to do
			set e to player position
			set rT to my doTime(e)
			try
				set {foo1, foo2, foo} to {artist, name, time} of current track
			on error
				set {foo1, foo2, foo3} to {"iTunes Music Store", "(unknown sample track)", ""}
			end try
			set foo4 to rT & " / " & foo3
			set foo5 to "[" & foo1 & "]" & "  :||:  " & foo2 & "  :||:  " & foo4
		end if
	end tell
	return foo5
end if
on doTime(x)
	set m to x div 60
	set s to (x - m * 60)
	if s < 10 then set s to "0" & s
	return m & ":" & s
end doTime

--> "[iTunes Music Store]  :||:  (unknown sample track)  :||:  0:02 / "
Anyway, it's all fun playing around with new ways to skin cats. Cheers

[ Reply to This | # ]
GeekTool - Useful and fun info on the desktop
Authored by: Frederico on Jul 11, '04 04:43:50AM
Oops! There's an error in the last line of that error handler; it reads:

try
set {d, foo1, foo2, foo} to {duration, artist, name, time} of current track
on error
Should read:

try
set {d, foo1, foo2, foo3} to {duration, artist, name, time} of current track
on error
Sorry!

[ Reply to This | # ]
GeekTool - Useful and fun info on the desktop
Authored by: Frederico on Jul 11, '04 06:47:45AM

Hmmmm... never mind that I neglected to account for the Radio playlist being active... Good thing I rarely ever listen to it.... (;



[ Reply to This | # ]
GeekTool - Useful and fun info on the desktop
Authored by: Frederico on Jul 12, '04 08:45:00PM
This version accounts for both Radio and Music Store:

--iTunesTracker: Copyright 2000 - Jayson Cote -- modified by Frederico
tell application "System Events" to set the process_flag to (exists process "iTunes")
if the process_flag then
	tell application "iTunes"
		set ps to player state
		if ps contains playing or ps contains paused or ps ¬
			contains stopped or ps contains rewinding or ps contains fast forwarding ¬
			then
			set e to player position
			set rT to my doTime(e)
			try
				set {foo1, foo2, foo3} to {artist, name, time} of current track
				if foo3 is missing value then set {foo1, foo2, foo3} to {"Internet Radio: " & foo2, current stream title, "(stream)"}
			on error
				set {foo1, foo2, foo3} to {"iTunes Music Store", "(unknown sample track)", "0:30"}
			end try
			set foo4 to rT & " / " & foo3
			set foo5 to "[" & foo1 & "]" & "  :||:  " & foo2 & "  :||:  " & foo4
		else
			return "iTunes Player State unknown"
		end if
	end tell
	return foo5
end if
on doTime(x)
	set m to x div 60
	set s to (x - m * 60)
	if s < 10 then set s to "0" & s
	return m & ":" & s
end doTime


[ Reply to This | # ]
GeekTool for a Weather Screensaver
Authored by: pmtav on Jul 10, '04 12:30:29PM

I've set up GeekTool to curl weather images every 10 min to a folder and selected that folder in the screensaver to display the images... voila, weather screensaver. Of course you could curl whatever images you want..

In GeekTool, I set several curls as a one-line command (all only one line), such as:

curl -o ~/Pictures/weather/us_ec_9regradar_large_usen.jpg http://image.weather.com/web/radar/us_ec_9regradar_large_usen.jpg; curl -o ~/Pictures/weather/ec_curtemp_720x486.jpg http://image.weather.com/images/maps/current/ec_curtemp_720x486.jpg

and checked "Hide Output". I could have set up the curls as a cron job, but GeekTool gives me an easier option to enable or disable the downloads..



[ Reply to This | # ]

What to do if GeekTool crashes
Authored by: Pausanias on Jul 13, '04 01:21:38AM

I've had GeekTool die on me---the preference pane was still there, but all the actual info windows disappeared. It was almost as if the "driver" application behind it crashed, while the UI stayed behind.

If you experience a similar GeekTool crash, just type "open -a GeekTool" in the Terminal or xterm. It seems to get everything working again.



[ Reply to This | # ]
What to do if GeekTool crashes
Authored by: Frederico on Jul 13, '04 03:43:06AM

I find that just choosing 'Force Refresh' kicks any missing display windows back into action.



[ Reply to This | # ]
What to do if GeekTool crashes
Authored by: Pausanias on Jul 13, '04 05:09:10PM

Yeah, I tried that, but didn't work. My guess is that it only works if the GeekTool application running. I think in my case that application had crashed, so "open -a GeekTool" was the only thing that worked.



[ Reply to This | # ]
What to do if GeekTool crashes
Authored by: bluehz on Jul 14, '04 12:24:32PM

FYI - I was having several system freezes requiring a hard restart with GeekTool activated. Cya later GeekTool...



[ Reply to This | # ]
Daily History Lesson
Authored by: FACEMILK on Jul 16, '04 12:10:55AM

My favorite noodle for GeekTool shows daily historic events:

grep -h "^$(date '+%m/%d')" /usr/share/calendar/calendar.{holiday,history,computer}|cut -f2



[ Reply to This | # ]
Daily History Lesson
Authored by: wallybear on Sep 28, '04 11:44:56AM

I cannot get to work that line, I get the following message:

tcsh: Illegal variable name.


BTW, I had success with this version of your script:

grep -h "^`date '+%m/%d'`" /usr/share/calendar/calendar.{holiday,history,computer} | cut -f2



[ Reply to This | # ]
evil yet hilarious geektool
Authored by: gerry81611 on Sep 28, '04 01:11:22AM

ok, this takes no skill to do (alert, scriptkiddies) but provides me with endless hours of entertainment. (yes, i am easily amused)

first, go get a copy of dsniff. the place that used to host the osx port is down, if you can't find it, reply and i'll post it somewhere.

when you boot up, open a shell and type:

sudo ps

and then enter your password, then

sudo dsniff -i en1 >en1.log &

en1 is of course the airport interface.

the ps part is because apparently if you launch a background task with & and it requires input, you will never see the prompt. I'm sure i could set it up somehow to automatically start with the computer (and if you know how, please tell me), but its not like i reboot all that often anyway.

then take the en1.log file and use it as the input to geektool and a screensaver like lotsofwords.

voila! all the plaintext passwords flying around on your local network show up on the desktop and as the screensaver.

hilarious lowbrow fun! secure ipfw properly and open up your WiFi network to the world! you could probably do the same thing with nmap too, if you were really motivated.. note that you should check your network policy before trying this at work.. passive sniffing is undetectable but might be against the rules, port scanning is usually detectable, and is almost certainly against the rules.



[ Reply to This | # ]
evil yet hilarious geektool
Authored by: gerry81611 on Oct 14, '04 05:23:27PM

in response to requests, dsniff is posted at http://dsniff.geraldkoh.com. enjoy!



[ Reply to This | # ]
evil yet hilarious geektool
Authored by: nachobel on Dec 08, '04 05:40:09PM

Hey, I downloaded the build you posted, but I can't seem to find anything that it has installed...

so, help?



[ Reply to This | # ]
birthdays on the desktop
Authored by: nick on Jan 09, '05 05:27:16PM
i'm shure this could be done MUCH better, but here are my efforts:

cd ~/Library/Calendars ; date "+SUMMARY%Y%m%d:TODAY" > today.tmp ; cat Geburtstage.ics today.tmp | grep "DTSTART\|SUMMARY" | sed s/"^M"// | sed '$!N;s/\n//' | sed s/"DTSTART;VALUE=DATE:"// | sed s/"SUMMARY"// | sed s/", Geburtstag "// | cut -c 5- | sort | grep -A 5 TODAY | grep -v TODAY | sed s/''// | sed s/":"/": "/

shows the next 5 pending birthdays.

[ Reply to This | # ]
note: replace "Geburtstage.ics" with your birthdays-calendar
Authored by: nick on Jan 09, '05 05:28:39PM

.



[ Reply to This | # ]
10 day forecast with geektool
Authored by: Oryman on Jan 12, '05 08:36:49PM
This script below works just fine with the terminal but when using geektool, there is no output. Any body can help? It would be cool to just have a text output of a weather forecast on the desktop. The script is:
wxurl="http://wwwa.accuweather.com"
wxurl="$wxurl/adcbin/public/local_index_print.asp?zipcode=97489"
size=999; shift
size=5
echo 
lynx -source "${wxurl}$1" | \
sed -n '/Start - Forecast Cell/,/End - Forecast Cell/p' | \
sed 's/<[^>]*>//g;s/^ [ ]*//g' | \
uniq | \
head -97489
exit 0


[ Reply to This | # ]
10 day forecast with geektool
Authored by: Sensei on May 17, '07 09:07:07PM

I know this thread is old, but I just discovered it.

I've noticed some issues with GeekTool requiring full paths for certain commands. I was able to get the 10 day forecast script to work by entering the full path for lynx as /sw/bin/lynx (I got lynx with fink, so that's why it's there).

I did the same thing with fortune that I got from fink.

---

"DON'T PANIC"
Douglas Adams



[ Reply to This | # ]
show www.humanclock.com-pictures on the desktop:
Authored by: nick on Jan 15, '05 06:53:32PM
www.humanclock.com is a website that shows different jpgs each minute. just have a look.

generate two geektool-tasks. one helper-task that extracts the name of the actual pic, downloads it and saves to a file. the second task just shows this pic.

1. curl `curl --cookie "hclock=$COOKIECONTENT" http://www.humanclock.com/clock.php | grep "http://www.humanclock.com/livefiles/digital" | sed s/"\""//g | sed s/".*updown src="/""/ | sed s/" border=0.*"/""/` > /tmp/humanclock.jpg

2. show the picture: file:///tmp/humanclock.jpg

replace $COOKIECONTENT with the content of the cookie named "hlock" saved by www.humanclock.com when beiing visited with firefox (in safari the content of a cookie cannot be copied). $COOKIECONTENT is something like
"13036%23%26uc%3D3%26ut%3D110577900 %26ua%3D0%26uz%3D60%26us%3D7108547e23
483c077267f34b3fa4337e%26uf%3D0%26ul%3D0
%26uL%3D0%26uo%3D0%26ux%3D0%26uj%3D1
%26ub%3D0%26uy%3D0%26um%3D1%26up%3D0
%26ui%3D1%26uh%3D%26uu%3DFF9933%23c57
75a7306758bacf5c659b4dbb91e84"
as one long line.

the site needs the cookie to figure out, in which timezone you are.

[ Reply to This | # ]
regard this hint: "A possible fix for GeekTool image display crashes"
Authored by: nick on Jan 15, '05 07:54:04PM

it crashes, if you don't regard this hint: http://www.macosxhints.com/article.php?story=20050111084206580&query=geektool

add this to the end of the 1. geektool entry:
; mv /tmp/humanclock.tmp.jpg /tmp/humanclock.jpg



[ Reply to This | # ]