Monthly Archive for August, 2006

Fortune cookies

Applescript is a scripting language I haven't played much with since I got my Powerbook. I actually haven't found any use of it...until now ;-)

I have created a small Applescript which uses the shell "utility" fortune to display some wisdom in the everyday work. From the man page for fortune: «fortune - print a random, hopefully interesting, adage». The following script lets the user loop through random quotes and smart little notes and gives the option to send it to the clipboard:

CODE:
  1. repeat
  2.     set f_text to (do shell script "/usr/local/bin/fortune -s -n 80
  3.            /usr/local/share/fortunes/computers")
  4.     display dialog ¬
  5.         f_text with icon 1 ¬
  6.         with title ¬
  7.         "Send Fortune to Clipboard?" buttons {"Cancel", "Next", "OK"} ¬
  8.         default button "Next"
  9.     if button returned of result is "Cancel" then
  10.         display dialog "Cancel"
  11.         exit repeat
  12.     else if button returned of result is "Next" then       
  13.     else
  14.         set the clipboard to f_text
  15.         exit repeat
  16.     end if 
  17. end repeat

*(set f_text to (do shell script "/usr/local/bin/fortune -s -n 80 /usr/local/share/fortunes/computers") should be one the same line)*

As you can see, I have specified some options for the fortune command. The following bit specifies that the length of the fortunes should not be more than 80 characters:

CODE:
  1. -s -n 80

-s can be replaced for -l to specify a minimum length instead. The path which I set at the end is the path to computer related cookies.

It is also possible to use this Applescript to set new status/mood messages in iChat/Skype (and possibly other IM applications too, but I have only tested on these). To do this, replace the line which says "set the clipboard to f_text" to:

CODE:
  1. tell application "iChat"
  2.     set the status message to f_text
  3. end tell
  4. tell application "Skype"
  5.     send command "SET PROFILE MOOD_TEXT" & f_text
  6. end tell

Incoming telephone spam

I now received spam on my phone too! I was sitting here working on my thesis when I heard the phone rang in the living room. It immidiately stopped, and there was a WAP Push message in my inbox. Obviously, the ringing was only for getting attention. The message said:

3 FREE Ringtones!

and the url for the message is http://no.widelive.com/index.wml?cp=17

Obviously, if I go to the address stated I will be downloading something (I do not trust it to be ringtones, and I'm not that interested in it either). Is this the new way of spamming people? I have never heard of this kind of spam before.

Btw: The number the call came from is: +911815011829

Technorati Tags: , ,

Skype – Online status

Skype includes an option to poll the online status from a username, and that is what I use for the online status display on the sidebar here. Since I want the plain text version (and not all caps like the one Skype offers), I used this code in a k2 php module:

PHP:
  1. $status = file_get_contents("http://mystatus.skype.com/lindsve.num");
  2. switch($status) {
  3.     case 0:
  4.         $message = "Unknown";
  5.         break;
  6.     case 1:
  7.       $message = "Offline";
  8.       break;
  9.     case 2:
  10.         $message = "Online";
  11.         break;
  12.     case 3:
  13.         $message = "Away";
  14.         break;
  15.     case 4:
  16.         $message = "Not Available";
  17.         break;
  18.     case 5:
  19.         $message = "Do Not Disturb";
  20.         break;
  21.     case 6:
  22.         $message = "Invisible";
  23.         break;
  24.     case 7:
  25.         $message = "Skype Me";
  26.         break;
  27. }
  28. echo "<p>$message</p>";

If you know of any easier way, please drop a line in the comments!

Technorati Tags: , ,

Updates

I have been quite busy lately, so it's been a while since my last post on this blog. My thesis is approaching the deadline, and there is still a lot of work to do, but I'm really looking forward to getting it done.

I have now updated the [Wordpress](http://www.wordpress.org) install here (to 2.0.4), and in the process moved the site over to the über-cool [k2](http://getk2.com) theme.

The image I use in the header is part of an image I took in the subway (Metro) in Copenhagen.

Technorati Tags: ,