Published on
August 25, 2006.
Tags: Apple, Blog.
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:
-
repeat
-
set f_text to (do shell script "/usr/local/bin/fortune -s -n 80
-
/usr/local/share/fortunes/computers")
-
display dialog ¬
-
f_text with icon 1 ¬
-
with title ¬
-
"Send Fortune to Clipboard?" buttons {"Cancel", "Next", "OK"} ¬
-
default button "Next"
-
if button returned of result is "Cancel" then
-
display dialog "Cancel"
-
exit repeat
-
else if button returned of result is "Next" then
-
else
-
set the clipboard to f_text
-
exit repeat
-
end if
-
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:
-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:
-
tell application "iChat"
-
set the status message to f_text
-
end tell
-
tell application "Skype"
-
send command "SET PROFILE MOOD_TEXT" & f_text
-
end tell
Published on
August 14, 2006.
Tags: Blog.
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
Published on
August 12, 2006.
Tags: Blog, Web.
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:
-
-
switch($status) {
-
case 0:
-
$message = "Unknown";
-
break;
-
case 1:
-
$message = "Offline";
-
break;
-
case 2:
-
$message = "Online";
-
break;
-
case 3:
-
$message = "Away";
-
break;
-
case 4:
-
$message = "Not Available";
-
break;
-
case 5:
-
$message = "Do Not Disturb";
-
break;
-
case 6:
-
$message = "Invisible";
-
break;
-
case 7:
-
$message = "Skype Me";
-
break;
-
}
-
If you know of any easier way, please drop a line in the comments!
Published on
August 12, 2006.
Tags: Blog.
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.
Recent Comments