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.
from: http://hasseg.org/icalBuddy/man.html

so what you have to do is this:
Code:
/usr/local/bin/icalBuddy -df "%e of %B" -f -sc -sd eventsToday+3 | sed -e "s/*/--/" | sed -e "s/!/!!/"

didnt try it, but it should work.


Thank you, brenm666. I did try that and it did change the date format but not for all of them (see image attached). However, it did not change the "Today at 4:00PM" and "Tomorrow at 10:00AM" The only ones effected were the items after "tomorrow". I don't mind the "today" but would prefer to lose "tomorrow" and have that say a date instead :confused: Do you know if this is possible?

Also, any idea if there is a way to make these things go into a second column from left to right instead of all the way down the screen?

Thanks a bunch!
 

Attachments

  • Screen shot 2011-03-03 at 11.13.59 PM.png
    Screen shot 2011-03-03 at 11.13.59 PM.png
    272.8 KB · Views: 156
Thank you, brenm666. I did try that and it did change the date format but not for all of them (see image attached). However, it did not change the "Today at 4:00PM" and "Tomorrow at 10:00AM" The only ones effected were the items after "tomorrow". I don't mind the "today" but would prefer to lose "tomorrow" and have that say a date instead :confused: Do you know if this is possible?

Also, any idea if there is a way to make these things go into a second column from left to right instead of all the way down the screen?

Thanks a bunch!

and -nrd to the script (no relative dates)

and i dont think its possible to make columns with geektool.
 
Head and Tail...

You are wonderful! That was easier than I thought and I learned a little bit too. Thank you kindly for your time and help :D

You might be able to use 'head' and 'tail' to put different sections of the same calendar into separate columns:
Code:
Column one:                        Column two:
long-ical-command | head -n 30     long-ical-command | head -n 60 | tail -n 30
This will put the first 30 lines in the first Geeklet, and the next 30 lines in the second column. Adjust depending how long your columns are.

You can fill your whole screen if you've got enough text :)
 
You might be able to use 'head' and 'tail' to put different sections of the same calendar into separate columns:
Code:
Column one:                        Column two:
long-ical-command | head -n 30     long-ical-command | head -n 60 | tail -n 30
This will put the first 30 lines in the first Geeklet, and the next 30 lines in the second column. Adjust depending how long your columns are.

You can fill your whole screen if you've got enough text :)

Dzurn! That's awesome. I think that is exactly what I need now. But please forgive me as I am very naïve when it comes to code and such. Here are my 2 commands.. where would I put the above code you suggested? Can you send me the code so I can just copy/paste? Sorry for any inconvenience and thank you in advance. This forum and its members has been so wonderful to me!

/usr/local/bin/icalBuddy -f -nrd -df "%A, %B %e" -sc -sd eventsToday+7 | sed -e "s/*/--/" | sed -e "s/!/!!/"

/usr/local/bin/icalBuddy -f -sc -sd -sdta uncompletedTasks | sed -e "s/*/--/" | sed -e "s/!/!!/"
 
Last edited by a moderator:
I had to fix my previous posting. This will remove the extra space and give you the correct ordinal suffix like "4th of March".

date +"%d of %B" | sed -E 's/([^1]1)/\1st/ ; s/([^1]2)/\1nd/ ; s/([^1]3)/\1rd/ ; s/^0// ; s/([0-9]) of/\1th of/'

I have mine setup to output like: Fri March 4th ... (Sorry I didn't mention that earlier). I tried various combos using yours, but couldn't get it to work - I've included my code this time for you to see.

Thanks very much!

Code:
date +"%a %B %e" | sed -E 's/([^1]1)$/\1st/' | sed -E 's/([^1]2)$/\1nd/' | sed -E 's/([^1]3)$/\1rd/' | sed -E 's/([0-9])$/\1th/'

My next question is about diplaying iCal events. I'm using iCal buddy and can display events, etc. without any problems, although is it possible to set it up to where an event would output to a single line of text, then cycle to the next event? i.e.

[ iCal Event ] (wait 2s) ↩ then clear the text and output next event in the same area. (repeat/loop)

Is that a tough one? I know that people have asked about having a ticker, or scrolling text, although I couldn't find anything that would work.

Thanks!
 
Last edited:
grabbing specific data from Wx feed

I have a pretty sharp geeked-up desktop if I do say so myself. Of course, I'm the only one who needs to care! :D

One thing I have not been able to figure out is how to take a specific line from the Yahoo current conditions Wx report. I grabbed the image for the Wx showing up on my desktop perfectly.

I also have (from a script I nabbed) the "basic" Wx. For instance, when one goes to Yahoo Wx there is a small box with "Current conditions..." Then there is a short summary such as "Mostly Cloudy."

What I want to grab individually is the data from each line they have:
Feels Like; Barometer; Humidity; Visibility; Dewpoint; Wind; UV Index; UV Description; Sunrise; Sunset.

Ideas?
 

Attachments

  • Geeked.JPG
    Geeked.JPG
    251.5 KB · Views: 453
Last edited:
Dzurn! That's awesome. I think that is exactly what I need now. But please forgive me as I am very naïve when it comes to code and such. Here are my 2 commands.. where would I put the above code you suggested? Can you send me the code so I can just copy/paste? Sorry for any inconvenience and thank you in advance. This forum and its members has been so wonderful to me!

/usr/local/bin/icalBuddy -f -nrd -df "%A, %B %e" -sc -sd eventsToday+7 | sed -e "s/*/--/" | sed -e "s/!/!!/"

/usr/local/bin/icalBuddy -f -sc -sd -sdta uncompletedTasks | sed -e "s/*/--/" | sed -e "s/!/!!/"

No problem. The marks like this "|" are called Pipes. That takes the output from the command on the left and sends it to the command on the right, and keeps going down the line. We can get really complicated using very simple commands this way. This is Unix shell scripting, and used outside GeekTool it is extremely rewarding and super-powerful! Your computer work could become much easier just learning a bit as you go.

So to "simulate" two columns, we use pipes to send the icalBuddy lines to head/tail lines. "Head" and "Tail" commands just take the input and give back a number of lines of the front or the back of the list in the pipeline.

As a dirt-simple example of head and tail, to show just the second week of the current month, you could use this:

cal | head -n 4 | tail -n 1

Now for your request: "head -n 20" gives the first 20 lines. To get the NEXT 20 lines, we do "head -n 40" to get the first 40, then "tail -n 20" to show the second set of 20 lines. For your own display, play with how many lines will fit and adjust these numbers in head/tail until you get it to work.

First command, first 20 lines:
/usr/local/bin/icalBuddy -f -nrd -df "%A, %B %e" -sc -sd eventsToday+7 | sed -e "s/*/--/" | sed -e "s/!/!!/" | head -n 20

First command, second 20 lines:
/usr/local/bin/icalBuddy -f -nrd -df "%A, %B %e" -sc -sd eventsToday+7 | sed -e "s/*/--/" | sed -e "s/!/!!/" | head -n 40 | tail -n 20

Second command, 1st 30 lines:
/usr/local/bin/icalBuddy -f -sc -sd -sdta uncompletedTasks | sed -e "s/*/--/" | sed -e "s/!/!!/" | head -n 30

Second command, 2nd 30 lines:
/usr/local/bin/icalBuddy -f -sc -sd -sdta uncompletedTasks | sed -e "s/*/--/" | sed -e "s/!/!!/" | head -n 60 | tail -n 30

Enjoy!
Darryl
 
I have mine setup to output like: Fri March 4th ... (Sorry I didn't mention that earlier). I tried various combos using yours, but couldn't get it to work - I've included my code this time for you to see.

Thanks very much!

Code:
date +"%a %B %e" | sed -E 's/([^1]1)$/\1st/' | sed -E 's/([^1]2)$/\1nd/' | sed -E 's/([^1]3)$/\1rd/' | sed -E 's/([0-9])$/\1th/'
...

Thanks!

You can get rid of all doubled spaces, in ANY command output, by adding another 'sed' call to the end.

Code:
date +"%a %B %e" | sed -E 's/([^1]1)$/\1st/ ; s/([^1]2)$/\1nd/ ; s/([^1]3)$/\1rd/ ; s/([0-9])$/\1th/' | sed -E 's/  / /'
 
Hi guys,

I'm the author of icalBuddy and it makes me happy to see people have found it useful. :)

I wanted to note that there is no need to pipe icalBuddy's output to sed anymore in order to change the bullet points, so these parts can be removed from the shell commands you're using:

| sed -e "s/*/--/" | sed -e "s/!/!!/"

What those commands do is replace the first occurrence of * to -- and ! to !! in each line in the output (the person who wrote these in the blog post many people have copied these parts from used them to change the default bullet points in the output of an old version of icalBuddy). In recent versions of icalBuddy the default bullet point is • (instead of *) so the first command can actually mess up parts of your output (if you e.g. have asterisks in the titles of some events). Also, the second part (with the exclamation points) will make it difficult to try out your commands in the Terminal (the exclamation point has a special meaning in the Bash shell).

If you actually want to change the bullet points, icalBuddy has the -b and -ab arguments for that exact purpose.

You might also find these useful: http://hasseg.org/icalBuddy/examples.html
 
ok. i need help with i ruby script i found on this thread. here it is.
Code:
#!/usr/bin/env ruby
#
# Author: Robert Jorgenson
# Author email: rjorgenson@gmail.com
require 'Date'
ABBR_DAYNAMES = {0, 'Su', 1, 'Mo', 2, 'Tu', 3, 'We', 4, 'Th', 5, 'Fr', 6, 'Sa'}

def days_in_month(year, month)
  return (Date.new(year, 12, 31) << (12 - month)).day
end

def day_in_month(year, month, day)
  return Date.new(year, month, day).wday
end

def build_day_array(year, month)
  day_array = Array.new
  for d in (1..days_in_month(year, month))
    day_array[d] = ABBR_DAYNAMES[day_in_month(year, month, d)]
  end
  day_array.shift
  return day_array * " "
end

def build_separator(year, month)
  color = "\e[30m" #black
  #color = "\e[37m" #uncomment for white
  separator_string = "██" # change this to change separator, best if 2 characters wide
  close = "\e[0m" # don't change this
  separator = Array.new
  for d in (1..days_in_month(year, month))
    if year == Time.now.year && month == Time.now.month && d == Time.now.day then
      separator[d] = "#{color}#{separator_string}#{close}"
    else
      separator[d] = "#{separator_string}"
    end
  end
  separator.shift
  return separator * "█"
end

def build_date_array(year, month)
  date_array = Array.new
  for d in (1..days_in_month(year, month))
    date_array[d] = d
  end
  date_array.shift
  date_array.each do |d|
    if d < 10 then
      date_array[(d-1)] = "0#{d}"
    end
  end
  return date_array * " "
end

year = Time.now.year
month = Time.now.month

puts build_day_array(year, month)
puts build_separator(year, month)
puts build_date_array(year, month)
it outputs like the image attached. but id like the middle part to be the opposite (black everywhere, or two spaces, even better... and two white blocks on today's date)

thanks for the help!
 

Attachments

  • Screen shot 2011-03-07 at 11.54.03 PM.png
    Screen shot 2011-03-07 at 11.54.03 PM.png
    31.1 KB · Views: 229
Need help with weather image

I am trying to get the weather image from weather.yahoo.com, but have been unsuccessful. The shell code gets the correct and full URL for the image. The script doesn't write the image to my documents folder (or anywhere else). I tried a number of things. Can anyone help me sort it out?
Thanks.

Shell:
Code:
curl --silent "http://weather.yahoo.com/canada/ontario/london-24224933/?unit=c" | grep "forecast-icon" | sed "s/.*background\\:url(\\'\\(.*\\)\\')\\;\\ _background.*/\\1/" | xargs curl --silent -o /localhost/Users/irvin/Documents/weather.png

Image:
Code:
file://localhost/Users/Me/Documents/weather.png
 
You can get rid of all doubled spaces, in ANY command output, by adding another 'sed' call to the end.

Code:
date +"%a %B %e" | sed -E 's/([^1]1)$/\1st/ ; s/([^1]2)$/\1nd/ ; s/([^1]3)$/\1rd/ ; s/([0-9])$/\1th/' | sed -E 's/  / /'

That worked beautifully! Thank you so much ~ :D
 
Playlist from iTunes

Hello,
I am searching for a Geektool code to give me the playlist for the current song playing from iTunes?!
I have searched and tried a lot of things but without any result.

Can somebody help me please ??? ;)
 
Hi guys,

I'm the author of icalBuddy and it makes me happy to see people have found it useful. :)

I wanted to note that there is no need to pipe icalBuddy's output to sed anymore in order to change the bullet points, so these parts can be removed from the shell commands you're using:

| sed -e "s/*/--/" | sed -e "s/!/!!/"

Good to know... I've removed it per your advice.
 
I am trying to get the weather image from weather.yahoo.com, but have been unsuccessful. The shell code gets the correct and full URL for the image. The script doesn't write the image to my documents folder (or anywhere else). I tried a number of things. Can anyone help me sort it out?
Thanks.

Shell:
Code:
curl --silent "http://ca.weather.yahoo.com/canada/ontario/london-24224933 | grep "forecast-icon" | sed "s/.*background\\:url(\\'\\(.*\\)\\')\\;\\ _background.*/\\1/" | xargs curl --silent -o /localhost/Users/irvin/Documents/weather.png

Image:
Code:
file://localhost/Users/Me/Documents/weather.png

your url is incorrect. heres what you have to change it to:
http://ca.weather.yahoo.com/canada/ontario/london-24224933

Hello,
I am searching for a Geektool code to give me the playlist for the current song playing from iTunes?!
I have searched and tried a lot of things but without any result.

Can somebody help me please ??? ;)

applescript (editor in utilities):
Code:
on run
	set newline to ASCII character 10
	set info to ""
	tell application "System Events"
		set num to count (every process whose name is "iTunes")
	end tell
	if num > 0 then
		tell application "iTunes"
			if player state is playing then
				set trackplaylist to name of current playlist
				set info to (trackplaylist)
			end if
		end tell
	end if
	return info
end run

and in geektool:
Code:
osascript path/of/your/file.scpt
you can output a lot more info than this. go look in the AS library to find more, or take a look other scripts posted on this thread a few months ago.
 
you can output a lot more info than this. go look in the AS library to find more, or take a look other scripts posted on this thread a few months ago.

Thank you for the answer. I have done a lot of things with geektool. Also using codes from this thread here. This thread is one of the best source for geeklets! :D

Here is my actual desktop before I have implemented your code. But I will do it right now ;)

EDIT: "trackplaylist" is the word I didn´t know before. This was my problem! ;)
 

Attachments

  • Big Apple 10-03-2011.jpg
    Big Apple 10-03-2011.jpg
    795.3 KB · Views: 486
Last edited:
Solved: Album or Playlist getting out of iTunes

With the help from brenm666 I have managed to get these information out of itunes I have searched for.
Now I would like to share the whole script for those who are also interested in.
I have pimped it a little to have two variations: when you play music from the iTunes library there was no information on playlist or album, just Music .
I have changed this to have the album name when you are listening to a special album or the name of the playlist when you have chosen from a playlist.
When iTunes is not running, nothing is shown on the desktop.

And here is the complete script:

set info to ""
tell application "System Events"
set the process_flag to (exists process "iTunes")
set apps to every process whose bundle identifier is equal to "com.apple.iTunes"
if (apps is {}) then return
end tell
if the process_flag then
tell application "iTunes"
if player state is playing then
set trackplaylist to name of current playlist
set albumName to the album of current track
if trackplaylist is "Musik" then
set info to "Album: " & (albumName)
else
set info to "Playlist: " & (trackplaylist)
end if
else
if player state is paused then
set trackplaylist to name of current playlist
set albumName to the album of current track
if trackplaylist is "Musik" then
set info to "Album: " & (albumName)
else
set info to "Playlist: " & (trackplaylist)
end if
end if
end if
end tell
info
end if


Have fun... :D
 

Attachments

  • Playlist out of iTunes.jpg
    Playlist out of iTunes.jpg
    153.8 KB · Views: 211
  • Album out of iTunes.jpg
    Album out of iTunes.jpg
    165.1 KB · Views: 156
I am currently using a script that displays my ical To-Do list but i have to create a separate shell command ("echo To-Do") so i see it is my To-Do list.
Is there a way that it is displayed with my ical script so that i don't need to create a separate shell command ?
Code:
/usr/local/bin/icalBuddy -nc uncompletedTasks | sed -e "s/*/--/" | sed -e "s/!/!!/"
 
Hi everyone,

There is something I'd like my geektool set-up to do (if it's possible), but I don't have the coding know-how to set it up. I was hoping one of you guys (or gals) can help me.

Basically, what I want to display the days of the week using the appropriate Kanji. So a script that checks the day, then returns the appropriate kanji. I think it's possible, and it doesn't seem complicated, but I don't know how to code.

Here's the list of days/kanji:

Sun - 日
Mon - 月
Tues - 火
Wed - 水
Thur - 木
Fri - 金
Sat - 土

Thanks in advance!
 
Status
Not open for further replies.
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.