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.
These are the applescripts you'll need.
(two geeklets, one for the thinner font and the other for the wider font.)
Font used is Helvetica Neue (regular & bold)

hour script,
Code:
set uren to {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty", "twentyone", "twentytwo", "twentythree", "twentyfour"}

return item (hours of (current date)) of uren

Minutes script,
Code:
set minuten to {"O'one", "O'two", "O'three", "O'four", "O'five", "O'six", "O'seven", "O'eight", "O'nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty", "twentyone", "twentytwo", "twentythree", "twentyfour", "twentyfive", "twentysix", "twentyseven", "twentynine", "thirty", "thirtyone", "thirtytwo", "thirtythree", "thirtyfour", "thirtyfive", "thirtysix", "thirtyseven", "thirtyeight", "thirtynine", "fourty", "fourtyone", "fourtytwo", "fourtythree", "fourtyfour", "fourtyfive", "fourtysix", "fourtyseven", "fourtyeight", "fourtynine", "fifty", "fiftyone", "fiftytwo", "fiftythree", "fiftyfour", "fiftyfive", "fiftysix", "fiftyseven", "fiftyeight", "fiftynine", "sixty"}

if (minutes of (current date)) = 0 then
	return "O'clock"
else
	return item (minutes of (current date)) of minuten
end if
 
i dont really mind... just throw me your hour script and ill try to figure it out... ;)


well, you dont have to change anything in your script, its in geektool that you have to change the "output encoding" (in the style section, between the background color and the alignment).

date and time:

date "+%A %d %B %l:%M:%S"
 

Attachments

  • Capture d’écran 2010-12-23 à 21.37.01.png
    Capture d’écran 2010-12-23 à 21.37.01.png
    110 KB · Views: 218
Last edited:
i dont really mind... just throw me your hour script and ill try to figure it out... ;)


well, you dont have to change anything in your script, its in geektool that you have to change the "output encoding" (in the style section, between the background color and the alignment).

the "output encoding" is UTF8 what do you think about? it's not the right choice :confused:
 
date and time:

date "+%A %d %B %l:%M:%S"

i had this one already... but i wanted to put it in letters... :p

here's what i got working... thanks tomge!
Code:
set jour to {"First", "Second", "Third", "Fourth", "Fifth", "Sixth", "Seventh", "Eighth", "Ninth", "Tenth", "Eleventh", "Twelfth", "Thirteenth", "Fourteenth", "Fifteenth", "Sixteenth", "Seventeenth", "Eighteenth", "Nineteenth", "Twentieth", "Twenty First", "Twenty Second", "Twenty Third", "Twenty Forth", "Twenty Fifth", "Twenty Sixth", "Twenty Seventh", "Twenty Eight", "Twenty Ninth", "Thirtieth", "Thirty First"}

set mois to {"Jan", "Feb", "Mar", "Avr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}

set semaine to {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}

return item (weekday of (current date)) of semaine & " the " & "
" & item (day of (current date)) of jour & "
of " & item (month of (current date)) of mois

edit:
try ASCII. i think this one should be better...
 
Last edited:
can someone please give me a basic weather for NYC? (not celsius) thanks.

and i see everyone has calendar codes and whatnot but no codes to list just the year?
anyone?
 
Last edited:
can someone please give me a basic weather for NYC? (not celsius) thanks.

and i see everyone has calendar codes and whatnot but no codes to list just the year?
anyone?

Read this post and replace the Yahoo Forecast RSS Feed url with the following:
Code:
http://weather.yahooapis.com/forecastrss?p=USNY0996&u=f

As for date and time stuff, that has been fully covered in this thread, but if you do a shell command geeklet with the following code, you'll get the year.
Code:
date +%Y
 
i had this one already... but i wanted to put it in letters... :p

here's what i got working... thanks tomge!
Code:
set jour to {"First", "Second", "Third", "Fourth", "Fifth", "Sixth", "Seventh", "Eighth", "Ninth", "Tenth", "Eleventh", "Twelfth", "Thirteenth", "Fourteenth", "Fifteenth", "Sixteenth", "Seventeenth", "Eighteenth", "Nineteenth", "Twentieth", "Twenty First", "Twenty Second", "Twenty Third", "Twenty Forth", "Twenty Fifth", "Twenty Sixth", "Twenty Seventh", "Twenty Eight", "Twenty Ninth", "Thirtieth", "Thirty First"}

set mois to {"Jan", "Feb", "Mar", "Avr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}

set semaine to {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}

return item (weekday of (current date)) of semaine & " the " & "
" & item (day of (current date)) of jour & "
of " & item (month of (current date)) of mois

edit:

try ASCII. i think this one should be better...[/QUOTE

O M G , in ASII it's awful

Joyeux noel a tous

Merry Christmas to all
 
I found that link when i tried googling for my answer. This is what i get every time.

Got that too.

All the code is in the attached .zip file. There are hardcoded paths in the scripts, so adjust accordingly to your directory structure. I have everything placed in ~/bin/geektool/.

The compdata.py script is able to be customized. There is code in there for the smilies that MOD YOU UPP wanted. That data is currently not being output, but if you know a little python, it isn't hard to add to the print statement.

As for the geeklet, set it up for shell and use the following command:
Code:
/path/to/executable/compdata.py
 

Attachments

  • cputemp_fan_scripts.zip
    5.8 KB · Views: 163
Last edited:
Auto-hiding items when programs are running fullscreen

Hi everyone,

I've just this evening gotten started with using GeekTool and I've done the current iTunes song in menubar shell thing, as well put an image(it's of Stewie Griffin's head, actually) over the apple logo in the top left. The problem is, both of these are set to 'always on top' to be displayed on top of the menu bar and when I want to watch anything in fullscreen, i can still see a little stewie an, if iTunes is open, the name of the song I was listening to. Is there a way of making these hide automatically if something goes into fullscreen / the menu bar is hidden?

Thanks,
Jonny

162650_466000097100_516747100_6148609_2405898_n.jpg
 
Python Script for a Daily Bible Verse in Geektool

Here is a Python Script written by my friend that extracts a daily bible verse from the website daily-verse.com. You need to install Beautiful Soup, which is a Python HTML/XML parser, and it can be found here, http://www.crummy.com/software/BeautifulSoup/ .

The script is:
from BeautifulSoup import BeautifulSoup
import urllib2
page = urllib2.urlopen("http://daily-verse.com/")
soup = BeautifulSoup(page)
thequotation = soup.h2.prettify()[12:][:-15]
thesource = soup.h3.prettify()[5:][:-7]
print thequotation + "\n" + "\n" + thesource

I used a Corsiva Hebrew Bold Font 18 points and full justification. Also, you need to remember to force carriage returns in Geektool. I hope you enjoy.

Regards,

Steve
 
sliding geeklet!

Hi,

I'm back with something "new" =D.
I've made me a geeklet that slides in and out when the track changes in iTunes.
click the link to see the video on imageshack. (20 seconds)

sliding geeklet

Next update will have something to do with a time geeklet (with animations)

kind regards
 
I made one that displays the latest Bug webcomic or a random one.
just paste this into a file called blah.sh and run it with your crontab or in a shell geeklet. I used the crontab because I can just have it run once a day.
latest:
Code:
IMAGE=`curl --silent http://www.bugcomic.com/ | grep http://www.bugcomic.com/comics/20 | sed 's|<div id="comic-1" class="comicpane"><a  href=".*" title=".*"><img src="||g' | sed 's|" alt=".*" title=".*" /></a>||g' | tr -d "\r" | tr -d "\t"`
curl --silent $IMAGE -o /tmp/latestBC.png

Then just put an image geeklet in with /tmp/latestBC.png as the image.

OR for a random comic:
Code:
IMAGE=`curl -L --silent http://www.bugcomic.com/?randomcomic | grep http://www.bugcomic.com/comics/20 | sed 's|<div id="comic-1" class="comicpane"><a  href=".*" title=".*"><img src="||g' | sed 's|" alt=".*" title=".*" /></a>||g' | tr -d "\r" | tr -d "\t"`
curl --silent $IMAGE -o /tmp/`basename $IMAGE`
sips -s format png /tmp/`basename $IMAGE` --out /tmp/latestBC.png
rm -f /tmp/`basename $IMAGE`

It took so long for me to figure out there was for some reason a return character at the end of the file name.... I tried so many whitespace removing commands and newline removing commands and everything.... and then... its \r... WTF
 
Last edited:
I would like the countdown to show Days Hours Minutes Secs (54 Days 13 Hours 55 minutes 34 secs). Currently it shows 54 Days 1309 hours 78596 Minutes and 4715801 Secs. Using the link at the top of this thread I figured out everything but the secs. It says to use Mod 60. I have tried several different ways but can't seem to get it to work. I am assuming I am not using the right context. Here is what I have so far:

THEN=`date -v11y -v2m -v21d -v0H -v0M -v0S +%s`
SECS=$(($THEN-$(date +%s)))
DAYS=$(($SECS/86400))
HOURS=$((($SECS/3600)-($DAYS*24)))
MINUTES=$((($SECS/60)-($DAYS*1440)-($HOURS*60)))
SECONDS=$(($SECS Mod 60))
echo "Days: " $DAYS
echo "Hours: " $HOURS
echo "Minutes: "$MINUTES
echo "Seconds: "$SECONDS

Any help would be great.
 
I would like the countdown to show Days Hours Minutes Secs (54 Days 13 Hours 55 minutes 34 secs). Currently it shows 54 Days 1309 hours 78596 Minutes and 4715801 Secs. Using the link at the top of this thread I figured out everything but the secs. It says to use Mod 60. I have tried several different ways but can't seem to get it to work. I am assuming I am not using the right context. Here is what I have so far:

THEN=`date -v11y -v2m -v21d -v0H -v0M -v0S +%s`
SECS=$(($THEN-$(date +%s)))
DAYS=$(($SECS/86400))
HOURS=$((($SECS/3600)-($DAYS*24)))
MINUTES=$((($SECS/60)-($DAYS*1440)-($HOURS*60)))
SECONDS=$(($SECS Mod 60))
echo "Days: " $DAYS
echo "Hours: " $HOURS
echo "Minutes: "$MINUTES
echo "Seconds: "$SECONDS

Any help would be great.

You don't have the modulus correct, the symbol is %.

Here is the correct code:
Code:
THEN=`date -v11y -v2m -v21d -v0H -v0M -v0S +%s`
SECS=$(($THEN-$(date +%s)))
DAYS=$(($SECS/86400))
HOURS=$((($SECS/3600)-($DAYS*24)))
MINUTES=$((($SECS/60)-($DAYS*1440)-($HOURS*60)))
SECONDS=$(($SECS%60))
echo "Days: " $DAYS
echo "Hours: " $HOURS
echo "Minutes: "$MINUTES
echo "Seconds: "$SECONDS

When I run this in my terminal window as a script, I get the following output:
Code:
Days:  54
Hours:  14
Minutes: 26
Seconds: 6
 
Hi guys.

I have this:
image-E66F_4D1DEFEA.jpg


But I can not figure out why the " , " is there.

My code:
Code:
echo $(top -F -R -d -l 1 | awk '/PhysMem/ {print ((4096-($6+$10))/4096)*100}' | sed -e '/-/s//100/' | cut -c1-3 | sed -e '/\.[0-9]*/s///')%;

What is wrong? ty and happy new year!
 
But I can not figure out why the " , " is there.

My code:
Code:
echo $(top -F -R -d -l 1 | awk '/PhysMem/ {print ((4096-($6+$10))/4096)*100}' | sed -e '/-/s//100/' | cut -c1-3 | sed -e '/\.[0-9]*/s///')%;

What is wrong? ty and happy new year!

It would appear that the filtering on the end (sed|cut|sed) is geared toward trimming off stuff after the "decimal point" (a period here in USA), whereas your Scandinavian system uses the comma instead.

Assuming the initial top|awk part is correct, the output is something like
12.3456 or 12,3456
and the massive sed|cut|sed downstream is just truncating the fractional portion.

i'd think that the whole thing could be boiled down to:

top -F -R -d -l 1 |awk '/PhysMem/ {print ((4096-($6+$10))/4096)*100}' |sed 's/[,.].*/%/'

...but if that doesn't look right on your system, then perhaps just change the last sed on your original from:

sed -e '/\.[0-9]*/s///')%

to:

sed 's/,[0-9]*/%/')


--

On further thought, not even one sed is needed... awk alone can do:

top -F -R -d -l 1 |awk '/PhysMem/ {printf "%d%%\n", ((4096-($6+$10))/4096)*100}'
 
Last edited:
It would appear that the filtering on the end (sed|cut|sed) is geared toward trimming off stuff after the "decimal point" (a period here in USA), whereas your Scandinavian system uses the comma instead.

Assuming the initial top|awk part is correct, the output is something like
12.3456 or 12,3456
and the massive sed|cut|sed downstream is just truncating the fractional portion.

i'd think that the whole thing could be boiled down to:

top -F -R -d -l 1 |awk '/PhysMem/ {print ((4096-($6+$10))/4096)*100}' |sed 's/[,.].*/%/'

...but if that doesn't look right on your system, then perhaps just change the last sed on your original from:

sed -e '/\.[0-9]*/s///')%

to:

sed 's/,[0-9]*/%/')


--

On further thought, not even one sed is needed... awk alone can do:

top -F -R -d -l 1 |awk '/PhysMem/ {printf "%d%%\n", ((4096-($6+$10))/4096)*100}'

Thank you very much! That last one worked! Again, thanks! :)
 
Status
Not open for further replies.
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.