Passing a variable from a webpage to an AppleScript
Passing a variable from a webpage to an AppleScript
- Subject: Passing a variable from a webpage to an AppleScript
- From: Christian Boyce <email@hidden>
- Date: Wed, 24 Oct 2001 15:43:42 -0700
I have a web-based interface for controlling my stereo and CD changer. I
display the currently-playing song and also the list of songs that is "on
deck." Naturally the list changes all the time-- the "on deck" song moves
to the top of the list, and everything moves up one notch every five
minutes or so.
I want to turn the list of songs that are "on deck" into a list of
clickable links. I have a program, TitleTrack Jukebox, that is scriptable
and indeed I can write a script like this:
tell application "2.0TitleTrack Jukebox" of machine "iMac"
Add to Playlist by Name "title_of_song" type class "track"
-- (title_of_song has to be known!)
Next
end tell
I know how to trigger an AppleScript by clicking a link. That part is
done. What I can't figure out is how do I get the value of
"title_of_song" into my script.
My HTML will look something like this:
<A HREF="playthissong.asc">Mary Don't You Weep</A>
<A HREF="playthissong.asc">The House That Jack Built</A>
<A HREF="playthissong.asc">How I Got Over</A>
I want my script (playthissong) to know which song title I clicked on. If
I can do that I'm home free.
Naturally, when "Mary Don't You Weep" is done playing, the song at the
top of the list will be "The House That Jack Built" so things don't stay
put positionally. And, they list of songs is very dynamic-- there is no
practical way to write, say, a script for every song in the CD changer.
There must be 3000 songs!
I am using "SiteCam" for my webserver. It has the ability to run
AppleScripts connected to a webpage as I've described above.
It all boils down to this: I am going to trigger a script by clicking on
a link. I want the pass AppleScript the text of what I clicked on. Can I?
--
Christian Boyce
http://www.christianboyce.com
Home of the famous "BoyceCams"