The Blog of Brad
Posts tagged applescript
Days of Code: A Perl Uploadr // Day 3
Jan 17th
Today was rather hectic; exam preparations (actually, there was some Perl and Apple Script involved there!), some homework, and …. life…. I will return to Perl code tomorrow. Just thought I’d update to say that there was no update.
Tomorrow will be back to routine of my Mon->Fri-ness so there will be ample time to spend in front of Espresso… even better if it’ll be with espresso!
CODE: Message Shown from List
Mar 20th
This AppleScript provides a simple function, if you need to show pre-determined text on your screen in a noticeable way, Quicksilver’s ‘Large Type’ function is great. This script allows you to enter the sets of text you need to show in the code then run the script to select the bit to show. To close it, select the “Cancel” button. Their is no reasonable limit to the length of the list. This script requires Quicksilver.
set myMessages to {"message 1", "message 2", "message 3", "message 4", "and so on and so on...."}
repeat
set selectedMsg to {choose from list myMessages}
if (selectedMsg as string) is "false" then --This is to detect if you pressed cancel.
exit repeat
quit
else
tell application "Quicksilver" to show large type (selectedMsg as string)
end if
end repeat
--you could have it do something here, after you've gone to exit the script.
CODE: Webkit (without timer function)
Feb 24th
As noted in an earlier post I’ve been working on a script which will get the latest Webkit (nightly) build and automatically install it, delete the old file, mount/unmount the dmg, then delete the DMG…. Here is the code (I will release the timer function code soon):
on run
getwebkitURL()
set webkitURL to the result
downTHEwebKIT(webkitURL)
set desktopURL to "~/Downloads/webkit-new.dmg"
set webkitexistingfile to "/Volumes/Macintosh HD/Applications/Webkit.app"
do shell script "rm -f -r /Volumes/Macintosh HD/Applications/Webkit.app"
do shell script "hdiutil attach ~/Downloads/webkit-new.dmg"
--do shell script "ditto /Volumes/WebKit/Webkit.app /Volumes/MacintoshHD/Applications/"
tell application "Finder"
delete "MacintoshHD:Applications:Webkit.app"
move (contents of "WebKit:WebKit.app") to "MacintoshHD:Applications"
end tell
do shell script "hdiutil unmount /Volumes/Webkit"
tell application "Finder"
delete "MacintoshHD:Users:bradleyarsenault:Downloads:webkit-new.dmg"
end tell
end run
on downTHEwebKIT(webkitURL)
set webkitURL to webkitURL
set desktopURL to "~/Downloads/webkit-new.dmg"
set curlURL to ("curl -o " & desktopURL & " " & webkitURL)
do shell script curlURL
end downTHEwebKIT
on getwebkitURL()
set curlURL to "curl http://nightly.webkit.org/"
do shell script curlURL
set webkitPage to the result
set osxOffset to the offset of "<p><strong><a href=" in (webkitPage as string)
set webkitshortPage to (characters (osxOffset + 20) thru (count webkitPage) in webkitPage as string)
set dmgOffset to the offset of ".dmg" in (webkitshortPage as string)
set webkitURL to characters (1) thru (dmgOffset + 3) of webkitshortPage as string
return webkitURL
end getwebkitURL
CODE: GrowlHotClock.scpt
Feb 2nd
Leo Laporte has an AppleScript he uses to time himself out for his weekend radio show as the show is syndicated and if he continues past a certain time will be cut off by commercials, and so wrote an AppleScript, hotclock.scpt, it uses Quicksilver for notifications. I thought this would be of use for any viewers/listeners of his show, and so I re-wrote the tellhost() calls in it to use Growl (to be less annoying). Here is my updated code. However you may want to change the times listed to offset the radio/internet delay… More >
CODE: IRC Notifier
Jan 27th
This is some more of the Applescript I’ve been poking around with: this one notifies for IRC. So far I have it established how to notify someone when a user enters/exits, I have no idea how to notify on keyword, response, etc… This requires Applescript on any version of Mac OS X and Growl. Code follows…
More >

