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.

astoxos

macrumors regular
Jul 18, 2012
183
40
Thanks a lot! I have one more question: Is it true that geektool prevents my macbook from sleeping when I close the lid?
 

ustamills

macrumors newbie
Jun 6, 2012
3
0
My humble submission: An ASCII clock

Admittedly this use of Geektool is a bit more involved. I apologize ahead of time. I'm a bit geeky, and a Perl programmer.

I found this Perl script on the perlmonks website and adopted it for geektool use. I've attached it as a .txt file so you'll need to remove the .txt extension. After running it the results looks like the attached screenshot (I couldn't figure out how to put the file inline in my msg).

Here's how you run it:

The basic version (DON'T try to use this version in geek tool):

myShell $> perl ~/asciiclock2.pl​

This will output a repeating set of clock images to STDOUT. Interesting to watch in the shell, but not very valuable. It never stops running until you Ctl-c out of the program. That's why you can't use it for Geektool like that.

The next version, useful for geek tool:

myShell $> perl ~/asciiclock2.pl --once​

This version only sends one copy of the clock to STDOUT. THIS is the one you want for geek tool in the geeklet Shell. Be sure you have the right path to the script.

If you don't want the second-hand you can add an arg --noseconds.

Probably the most unobvious need is picking a good font. Fixed fonts are usually better but I found a variable-width font that worked too.

For most of you the above usage is all you need to run it. HOWEVER, I just had to get a bit more geeky on it. Here's why: I would like to see the second hand updating every second. But loading Perl (on my laptop) takes just too long. I can't get the Geektool update to happen every second. So what I did was run the clock in a background shell (I'll leave that up to you) but using only the --ofile "myfilename" argument. That option re-creates the file named "myfilename" everytime it writes the clock out to it. And since Perl never unloads and the script loops every second, then that file constantly has the right time in it. So my geeklet Shell command now is only this:

cat myfilename​

Of course use the right filename there. With that I can update the geeklet every second because 'cat' processes very quickly.

A PROBLEM:

Sometimes the 'cat' command in Geektool just so happens to read the file exactly when it has first been emptied. The clock disappears for a moment. Not sure what I can do about that.

Hope you enjoy this. I did. :)

Drew
 

Attachments

  • asciiclock2.pl.txt
    4.1 KB · Views: 211
  • Screen Shot 2012-08-28 at 10.02.24 PM.png
    Screen Shot 2012-08-28 at 10.02.24 PM.png
    82.8 KB · Views: 2,123

gr4z

macrumors 6502
Aug 7, 2010
318
48
England
Living Earth HD

With this new app I have now removed my Yahoo weather script as this app does it all for you :) and more. Here is my new live desktop with Living Earth HD providing the desktop and weather.
 

Attachments

  • Desktop.png
    Desktop.png
    1.5 MB · Views: 524

spriter

macrumors 65816
May 13, 2004
1,460
586
Hey all,

Bit of a novice here and would love the advice of some experts to help me figure this out.

Basically, I'd like to have Geektool show the month, weekday, and date in Chinese.

I managed to track down a couple of scripts for the first two from MR, but when I tried to mod them to get the Date (as a number), it doesn't quite work.


Code:
Day
date "+%A" | sed -e 's/Monday/星期一/g' -e 's/Tuesday/星期二/g' -e 's/Wednesday/星期三/g' -e 's/Thursday/星期四/g' -e 's/Friday/星期五/g' -e 's/Saturday/星期六/g' -e 's/Sunday/星期日/g'

Code:
Month
date "+%B" | sed -e 's/January/一月/g' -e 's/February/二月/g' -e 's/March/三月/g' -e 's/April/四月/g' -e 's/May/五月/g' -e 's/June/六月/g' -e 's/July/七月/g' -e 's/August/八月/g'  -e 's/September/九月/g'  -e 's/October/十月/g'  -e 's/November/十一月/g'  -e 's/December/十二月/g'


The Day and Date work fine, but the Date drops some Chinese characters. e.g 29 should be written/shown as 二十九 but I'm getting 二九 instead. :confused:

This is my code below, attempting to swap out English for Chinese using the same method as those scripts above.

Code:
Date
date "+%d" | sed -e 's/1/一/g' -e 's/2/二/g' -e 's/3/三/g' -e 's/4/四/g' -e 's/5/五/g' -e 's/6/六/g' -e 's/7/七/g' -e 's/8/八/g' -e 's/9/九/g' -e 's/10/十/g' -e 's/11/十一/g' -e 's/12/十二/g' -e 's/13/十三/g' -e 's/14/十四/g' -e 's/15/十五/g' -e 's/16/十六/g' -e 's/17/十七/g' -e 's/18/十八/g' -e 's/19/十九/g' -e 's/20/二十/g' -e 's/21/二十一/g' -e 's/22/二十二/g' -e 's/23/二十三/g' -e 's/24/二十四/g' -e 's/25/二十五/g' -e 's/26/二十六/g' -e 's/27/二十七/g' -e 's/28/二十八/g' -e 's/29/二十九/g' -e 's/30/三十/g' -e 's/31/三十一/g'


Any help to get it to output properly would be :D
 

CarbonX

macrumors newbie
Aug 8, 2010
26
8
Singapore
Hey all,

Bit of a novice here and would love the advice of some experts to help me figure this out.

Basically, I'd like to have Geektool show the month, weekday, and date in Chinese.

I managed to track down a couple of scripts for the first two from MR, but when I tried to mod them to get the Date (as a number), it doesn't quite work.


Code:
Day
date "+%A" | sed -e 's/Monday/星期一/g' -e 's/Tuesday/星期二/g' -e 's/Wednesday/星期三/g' -e 's/Thursday/星期四/g' -e 's/Friday/星期五/g' -e 's/Saturday/星期六/g' -e 's/Sunday/星期日/g'

Code:
Month
date "+%B" | sed -e 's/January/一月/g' -e 's/February/二月/g' -e 's/March/三月/g' -e 's/April/四月/g' -e 's/May/五月/g' -e 's/June/六月/g' -e 's/July/七月/g' -e 's/August/八月/g'  -e 's/September/九月/g'  -e 's/October/十月/g'  -e 's/November/十一月/g'  -e 's/December/十二月/g'


The Day and Date work fine, but the Date drops some Chinese characters. e.g 29 should be written/shown as 二十九 but I'm getting 二九 instead. :confused:

This is my code below, attempting to swap out English for Chinese using the same method as those scripts above.

Code:
Date
date "+%d" | sed -e 's/1/一/g' -e 's/2/二/g' -e 's/3/三/g' -e 's/4/四/g' -e 's/5/五/g' -e 's/6/六/g' -e 's/7/七/g' -e 's/8/八/g' -e 's/9/九/g' -e 's/10/十/g' -e 's/11/十一/g' -e 's/12/十二/g' -e 's/13/十三/g' -e 's/14/十四/g' -e 's/15/十五/g' -e 's/16/十六/g' -e 's/17/十七/g' -e 's/18/十八/g' -e 's/19/十九/g' -e 's/20/二十/g' -e 's/21/二十一/g' -e 's/22/二十二/g' -e 's/23/二十三/g' -e 's/24/二十四/g' -e 's/25/二十五/g' -e 's/26/二十六/g' -e 's/27/二十七/g' -e 's/28/二十八/g' -e 's/29/二十九/g' -e 's/30/三十/g' -e 's/31/三十一/g'


Any help to get it to output properly would be :D

The problem with your script is that sed processes the single character 2, changing it to the chinese character equivalent of 二, before it substitutes the 9 with the equivalent of 九. Now, if you moved the commands such that sed replaces the two digit dates first, you would get the correct output of 二十九 for today's date. See below for edited code.

Code:
Date
date "+%d" | sed -e 's/10/十/g' -e 's/11/十一/g' -e 's/12/十二/g' -e 's/13/十三/g' -e 's/14/十四/g' -e 's/15/十五/g' -e 's/16/十六/g' -e 's/17/十七/g' -e 's/18/十八/g' -e 's/19/十九/g' -e 's/20/二十/g' -e 's/21/二十一/g' -e 's/22/二十二/g' -e 's/23/二十三/g' -e 's/24/二十四/g' -e 's/25/二十五/g' -e 's/26/二十六/g' -e 's/27/二十七/g' -e 's/28/二十八/g' -e 's/29/二十九/g' -e 's/30/三十/g' -e 's/31/三十一/g' -e 's/1/一/g' -e 's/2/二/g' -e 's/3/三/g' -e 's/4/四/g' -e 's/5/五/g' -e 's/6/六/g' -e 's/7/七/g' -e 's/8/八/g' -e 's/9/九/g'
 

spriter

macrumors 65816
May 13, 2004
1,460
586
The problem with your script is that sed processes the single character 2, changing it to the chinese character equivalent of 二, before it substitutes the 9 with the equivalent of 九. Now, if you moved the commands such that sed replaces the two digit dates first, you would get the correct output of 二十九 for today's date. See below for edited code.

:D Thanks CarbonX, that makes sense to this n00b. :D
 

bgreen1617

macrumors newbie
Sep 1, 2012
2
0
Weather Forecast Icons

Just a simple desktop with date/time and weather with forecast

Image

Hey,

Awesome and clean background man! How did u get your 5 day forecast icons with high and low temps to display. My yahoo script stopped working when they removed the widget option from the site. Would greatly appreciate the script you used. Thx
 

yetiboy

macrumors member
Mar 23, 2011
35
0
Weather image - again

I know this keeps coming up, but none of the suggestions given so far on here seem to work for me. I've tried using various scripts as well as the Ultimate Weather Script, but nothing seems to work.

I'm trying to get the weather image for
http://ca.weather.yahoo.com/canada/ontario/beachburg-3352/

Any help would be greatly appreciated, I've been without the image for months now.

EDIT: Incidentally, I tried the location grabber script to make sure it was working properly in the Ultimate Weather Script and it seems to be working fine, so that's not the issue.

yeti
 

bgreen1617

macrumors newbie
Sep 1, 2012
2
0
Weather Fix

I know this keeps coming up, but none of the suggestions given so far on here seem to work for me. I've tried using various scripts as well as the Ultimate Weather Script, but nothing seems to work.

I'm trying to get the weather image for
http://ca.weather.yahoo.com/canada/ontario/beachburg-3352/

Any help would be greatly appreciated, I've been without the image for months now.

EDIT: Incidentally, I tried the location grabber script to make sure it was working properly in the Ultimate Weather Script and it seems to be working fine, so that's not the issue.

yeti

Well this video set me straight if you follow it to the letter.

http://youtu.be/fUUGgtdGhaA

I still can not, for the life of me, find the script/image to get the images for the five day forecast working like gardnerd4me has on his desktop pic. If anybody can provide scripts please help.
 

BlakeBrattina

macrumors 6502a
May 10, 2011
542
61
Bay City, MI
Hi all,

I have been cruising this forum trying to find the example of what I have seen before of a script that will show the calendar items that I have for that day, but I can't seem to find it anywhere!

If anyone has an idea of what I am talking about, or possibly a script that would work for that, I would greatly appreciate the help!
 

DunkinDonutss

macrumors newbie
Sep 5, 2012
5
0
somehow all my geektool groups went missing twice in the past few days (had to recreate them). The groups themselves are still there but all shells and images that belong to these groups have vanished. Any ideas why that might be?
 

xtacocorex

macrumors regular
Oct 23, 2010
244
0
Iowa
Hi all,

I have been cruising this forum trying to find the example of what I have seen before of a script that will show the calendar items that I have for that day, but I can't seem to find it anywhere!

If anyone has an idea of what I am talking about, or possibly a script that would work for that, I would greatly appreciate the help!
You need to get iCalBuddy. It's a command line tool to display your iCal events. The website has sample commands for geektool.
 

yetiboy

macrumors member
Mar 23, 2011
35
0
Unbelievable, one week after finally getting it working again it's crapped out. The image is still there on Yahoo, but I'm not getting it. What the hell, have they changed their site again?

yeti
 

WeatherWarning

macrumors newbie
Jul 31, 2012
6
0
Yeti, give this a shot:

curl --silent "http://ca.weather.yahoo.com/canada/ontario/beachburg-3352/" | grep "current-weather" | sed "s/.*background\:url.'//g" | sed "s/'. no.*.//g" | xargs curl --silent -o /Users/YOURHOMEFOLDER/WHERETHISISGOING/weather.png​

Set up two geeklets: one to run the above that downloads the image; and a second that displays the image.
 

jephri

macrumors newbie
Sep 2, 2012
11
0
quotes from txt file

Hiya,

I was wondering if it is possible to get geektool to display text from a XLS, CSV or txt file, but i only want one line at a time.

the source file will have one line of text for each day of the year, and i would like geektool to check system date and display the corresponding line of text.

I have searched the net and i cant find anything like this.

your assistance would be greatly appreciated

Thanks
 

vpaterno

macrumors newbie
Sep 14, 2012
14
0
Hiya,

I was wondering if it is possible to get geektool to display text from a XLS, CSV or txt file, but i only want one line at a time.

the source file will have one line of text for each day of the year, and i would like geektool to check system date and display the corresponding line of text.

I have searched the net and i cant find anything like this.

your assistance would be greatly appreciated

Thanks

I can help you if you supply a sample of your CSV file. It's probably better to use a CSV file for parsing purposes.

----------

Here's my setup on my 15" pro. It shows the current weather (using the stock icon set that's built into OS X), what's currently playing on iTunes or Spotify along with it's album artwork and the current date. Oh, and awesome food cooked and photographed by yours truly. If anyone's interested in the script, let me know. It uses a combination of perl, bash, and applescript.
 

Attachments

  • Screen Shot 2012-09-14 at 3.31.53 PM.png
    Screen Shot 2012-09-14 at 3.31.53 PM.png
    1.9 MB · Views: 240
  • Screen Shot 2012-09-14 at 3.31.55 PM.png
    Screen Shot 2012-09-14 at 3.31.55 PM.png
    97.2 KB · Views: 1,754
Last edited:

jephri

macrumors newbie
Sep 2, 2012
11
0
I can help you if you supply a sample of your CSV file. It's probably better to use a CSV file for parsing purposes.

----------

Thanks for your help on this. The format of the file isnt a huge issue, I would like each row displayed for each day of the year. The file would have 365 rows. a cutdown version of csv file is attached

The cvs file has been zipped as forum wont allow csv attachments :)
 

Attachments

  • test.zip
    564 bytes · Views: 160

vpaterno

macrumors newbie
Sep 14, 2012
14
0
I can help you if you supply a sample of your CSV file. It's probably better to use a CSV file for parsing purposes.

----------

Thanks for your help on this. The format of the file isnt a huge issue, I would like each row displayed for each day of the year. The file would have 365 rows. a cutdown version of csv file is attached

The cvs file has been zipped as forum wont allow csv attachments :)


You're going to want to list your CSV as actual days rather than just day names. Is it numbers that you wanted to display on your screen, as your csv suggests or is it actual messages?

Can you format your CSV to look something like this?

0,"Message of the day"
1,"A different message for this day"
2,"Another message for another day"


Another option is to use a perl hash in the code if you don't plan on changing the messages at all but with any knowledge of perl, or even a lack thereof, you can easily edit the hash itself. Can you zip up the whole file along with the actual messages you'd like to display?
 

jephri

macrumors newbie
Sep 2, 2012
11
0
I dont mind numbering the days, instead of naming the days, thats not a huge issue, but if that is the case then I would like to have text and numbers displayed, i.e.

1, "4.56 7.32 8.43 9.65 9.43"
2, "4.56 7.32 8.43 9.65 9.43"

The main reason for this is to display numbers, text and numbers would be great, but ultimately i would like numbers. the format or layout of the csv file isnt a huge issue either. it would be very like the one i posted before, that was for a month, the larger would be for 12 months, but exactly same format.

The main factors i would appreciate are that each that column spacing doesn't change too dramatically day to day. and that it only displays one day at a time. each day corresponds to an actual day in the year.

I have thought of doing this via a calendar entry, but CSV or TXT file is pref.

i dont know any coding at all, perl or other wise. I dont mind using perl, but i dont want to inconveniece anyone else either. I though this would be rather simple.
 

vpaterno

macrumors newbie
Sep 14, 2012
14
0
I dont mind numbering the days, instead of naming the days, thats not a huge issue, but if that is the case then I would like to have text and numbers displayed, i.e.

1, "4.56 7.32 8.43 9.65 9.43"
2, "4.56 7.32 8.43 9.65 9.43"

The main reason for this is to display numbers, text and numbers would be great, but ultimately i would like numbers. the format or layout of the csv file isnt a huge issue either. it would be very like the one i posted before, that was for a month, the larger would be for 12 months, but exactly same format.

The main factors i would appreciate are that each that column spacing doesn't change too dramatically day to day. and that it only displays one day at a time. each day corresponds to an actual day in the year.

I have thought of doing this via a calendar entry, but CSV or TXT file is pref.

i dont know any coding at all, perl or other wise. I dont mind using perl, but i dont want to inconveniece anyone else either. I though this would be rather simple.

Here's something quick I typed up. You have two options, load this as a shell geeklet or a file geeklet. I personally like saving the file somewhere so I can use a real code editor to edit it thus loading it in geektool as a file geeklet.

Format your txt file with one line per day. There's no need to use a csv as you're attempting something simple.

E.G.:

this is my first line
this is my second line
this is my third line
and so on ...

Code:
#!/bin/perl

# Use a text file with 365 lines.

# Open the file for reading
# Change the filepath to the path and name of the location of your file.
open FILE, "<", "INSERT FILE PATH HERE" or die "Can't find file, check the path.\n";

# All we really need is the day of the year ($yyear).
# Keep in mind this starts with 0 so the last day of the year is 364.
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);

# Start a counter
my $c = 0;

# Loop through the file
while (<FILE>) {
    if ($c == $yday) {
        print $_;
        last;
    }
    $c++;
}

# Close out the file
close FILE;
 

jephri

macrumors newbie
Sep 2, 2012
11
0
daily from txt file

hiya, thanks for all your help, but i think i am doing something wrong here as it not working for me,

i have a txt file with 365 lines in it, for now, as an sample it only says

line 1
line 2
line 3
etc I have attached this for you in case it helps.

i then load a geektool shell and copy and paste in the code you provided, with the file path inserted (i have included a txt file of the code entered into geek tool) but this doesn't work.
 

Attachments

  • 365.zip
    2 KB · Views: 142

jephri

macrumors newbie
Sep 2, 2012
11
0
Here are two scripts I use to display an RSS News Feed from Yahoo and the current mupromo.com software.

RSS Feed:

Code:
curl --silent "http://rss.news.yahoo.com/rss/topstories" | grep -E '(title>)' | \
  sed -n '4,$p' | 
  sed -e 's/<title>//' -e 's/<\/title>//' |
  sed -e 's/<!\[CDATA\[//g' |            
  sed -e 's/\]\]>//g' |         
  sed -e 's/<[^>]*>//g' |   
  sed -e '/^[ ]*$/d' |
  head $headarg

mupromo.com:

Software:

Code:
curl --silent "http://www.mupromo.com" | grep "div class=\"head1\"" | sed -e 's/<div class=\"head1\">//' | sed -e 's/<.*//'

Description:

Code:
curl --silent "http://www.mupromo.com" | grep "div class=\"body1-content\">" | sed -e 's/<[^>]*>//g'


Thank you for the above, it fits what i was after. Im not a geek / programmer thus dont understand the script, the RSS i am pulling does display the data, but not in a syle i like, can someone explain what each lie of the code does please?
 

vpaterno

macrumors newbie
Sep 14, 2012
14
0
hiya, thanks for all your help, but i think i am doing something wrong here as it not working for me,

i have a txt file with 365 lines in it, for now, as an sample it only says

line 1
line 2
line 3
etc I have attached this for you in case it helps.

i then load a geektool shell and copy and paste in the code you provided, with the file path inserted (i have included a txt file of the code entered into geek tool) but this doesn't work.

Can you open up a terminal window (just use spotlight and type in Terminal, you should get a command prompt), type in perl, paste the code you're using, and press CTRL + D? Once that's done, paste the result.

EDIT:

It appears the file you're using is using a carriage return (\r) rather than a new line (\n) to terminate each line ending. It's not ideal but I've changed the code to read the whole file and effectively strip and replace these with new lines.

Code:
#!/bin/perl

# Use a text file with 365 lines.

# Open the file for reading
# Change the filepath to the path and name of the location of your file.
open FILE, "<", "FILE PATH HERE" or die "Can't find file, check the path.\n";

# All we really need is the day of the year ($yyear).
# Keep in mind this starts with 0 so the last day of the year is 364.
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);

# Load the whole thing into a string, not ideal.
my $file = <FILE>;
# Replace carriage returns.
$file =~ s/\r/\n/g;
my @info = split(/\n/,$file);

print "$info[$yday]\n";

# Close out the file
close FILE;
 
Last edited:
Status
Not open for further replies.
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.