8

Daily Dilbert strip

Posted in Images by Ivyleaf 2866 days ago

Geeklet to display the current Dilbert comic strip on the desktop.

The first geeklet contains all the code to fetch and process the image and the second geeklet just displays the temporary image saved by the first.

Initially I was having a problem that both geeklets were refreshing simultaneously and therefore the image wouldn't always roll forward. I managed to fix this issue by setting the picture to not refresh at all, and the last line of the shell script calls an inline AppleScript to manually refresh the picture:

osascript -e 'tell application "GeekTool Helper" to refresh geeklet id "2D23E26D-9270-4723-89F7-CA63B0901524"'

I have used the same approach with the weather icon... having the image fetch script update the picture and setting no refresh on the picture itself.

Other than that, I am very new to both AppleScript and Shell scripting so if you think anything can be cleaned up, let me know.


Geeklet files to download

Comments

User Avatar
Ivyleaf 2866 days ago
Please note, I seem to have picked the wrong day to post this unfortunately. For some strange reason there does not appear to be a Dilbert strip for the 8th of January 2012. It should work fine any other day.
User Avatar
hezahonker 2864 days ago
Thanks for posting this, unfortunately it is not working on mac running Snow Leopard. Any advice. I am downloading above Geeklet, double clicking which installs but no image appears even after refreshing all. Any changes that I need to make to command line?
User Avatar
Ivyleaf 2864 days ago
As well as the code Geeklet (download above) you will need to create a new image Geeklet to display the picture. Once you have created the image Geeklet, assign the image to it, and then you will also need to update the line of code that refreshes the image Geeklet with the correct ID. You can find the ID in the bottom of the property window when you have the image Geeklet selected

Hopefully this helps. Also, just check in your /Pictures folder... if the code Geeklet is working you should see the dilbert strip file there.
User Avatar
hezahonker 2864 days ago
Thanks for the clarification. It has been a long while since I used GeekTool and it is coming back... thanks for the nudge.
User Avatar
hezahonker 2864 days ago
Doesn't appear the geeklet is working for me. Oh well.
User Avatar
hezahonker 2864 days ago
no image in the pictures folder EDIT: ok it finally popped up. mac is acting strangely today. sorry and thanks again. all is working.
User Avatar
Ivyleaf 2863 days ago
Happy to hear you got it working :)
User Avatar
cdevine 2861 days ago
hi, im kinda new and don't know how to assign the image to the command, can someone please help?, thanks
User Avatar
Ivyleaf 2859 days ago
Once you download and open the 'Dilbert Code' geeklet (above), you should get an empty box showing up on your screen when you have the GeekTool preferences window open. This should already be running the code to grab the Dilbert image off the internet, so within a minute you should have a new file in your 'Pictures' folder called 'DilbertStrip.jpg'.

If you can see that file in your Pictures folder, then you're almost done with only two bits left. In the GeekTool preferences window, there are three geeklets visible there... 'File', 'Image' and 'Shell'. Drag the 'Image' one onto the desktop somewhere and this has created a new image geeklet. With that one selected, you will see the grey Properties window for it and about half way down there is a field called 'URL'. Just below the field is a button labelled 'Set local path'. Click that and you can browse to your Pictures folder and then double click the 'DilbertStrip.jpg' file.

You should now see the cartoon on your desktop. The only thing left to do is link the two geeklets together so that when the code runs to get the file, it subsequently updates the image geeklet. To do this look right down the bottom of the grey Properties dialog while you have the new Image geeklet selected. You will see a long code like "2D23E26D-9270-4723-89F7-CA63B0901524". Write this down somewhere and then you need to paste that over the code in the last line of the Dilbert Code geeklet. To get to the script, click the empty 'Dilbert Code' geeklet and in the grey Properties window, look for the 'Command' box (you should see the text '#!/bin/bash" in it already). To the right of the box, click the elipsis button (it only appears when you mouse over it). Click this and you will see the full script. Scroll down the bottom and replace the code that is already there with the one you wrote down earlier.

I hope this gets it working for you, and sorry for the detailed instructions... I'm not sure how new 'kinda new' is :)
User Avatar
cdevine 2855 days ago
thank you so much for your answer, i think i understand how to do it, the only problem is that i don't have an image labeled DailyDilbert.jpg
User Avatar
panhead 2854 days ago
cdevine, look for this line in the script DILFILE="/Users/cam366/Pictures/DilbertStrip.jpg"

change the cam366 to your user profile like cdevine
User Avatar
cdevine 2854 days ago
thank you so much, once i did that it popped up and works fine

Log in to comment or register here.