My First Applescript

Applescript! Never really used it before. Mainly cause I was afraid of it’s natural language syntax. But today, I decided that has to change.

Since I’ve been forced to link the videos I’ve recently posted using Quicktime’s embedded player, I needed something to help me write the bit of HTML that makes the magic happen. So what better way to try my hand at Applescript than with this little problem.

The great thing about Applescript is that it’s available everywhere in MacOS

Applescript Menu

Here’s my first Applescript script:

-- Video
-- (My First Applescript)
-- Takes video and poster URLs and generates a bit of HTML that can be copied to the clipboard

-- Properties property nl : ASCII character 10 -- Video display dialog "Enter Video URL" default answer "http://video.raishad.com/" buttons {"OK"} default button 1

set videourl to the text returned of the result display dialog "Enter Poster URL" default answer videourl buttons {"OK"} default button 1

set posterurl to the text returned of the result set objecttag to ("<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="320" height="256" standby="Data is loading..." codebase="http://www.apple.com/qtactivex/qtplugin.cab">" & nl & ¬

"<param name="href" value="" & videourl & "" />" & nl & ¬ "<param name="src" value="" & posterurl & "" />" & nl & ¬ "<param name="autoplay" value="false" />" & nl & ¬ "<param name="controller" value="false" />" & nl & ¬ "<param name="target" value="myself" />" & nl & ¬ "<embed href="" & videourl & "" src="" & posterurl & "" width="320" height="256" autoplay="false" controller="false" target="myself" />" & nl & ¬ "</object>")

display dialog object_tag buttons {"Cancel", "Copy to Clipboard"} default button 2 if button returned of result is "Copy to Clipboard" then

set the clipboard to object_tag end if

Also, 10.4.3 is out,

10.4.3

This entry was posted in Apple, Software. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

One Comment

  1. Posted November 1, 2005 at 12:18 am | Permalink

    Everyone knows batch files are superior. Kowtow before your Windows lord

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">