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'
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'
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'
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.
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![]()
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'
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.
Please tell me you can post that wallpaper here.I must have it.
my latest, simple upgrade.
![]()
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.
You need to get iCalBuddy. It's a command line tool to display your iCal events. The website has sample commands for geektool.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!
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.
----------
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![]()
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?
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.
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;
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.
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'
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;