Re: AS and SSI
Re: AS and SSI
- Subject: Re: AS and SSI
- From: Jeffrey W Baumann <email@hidden>
- Date: Sat, 19 May 2001 13:41:32 -0500
Yes indeedy, this can be done.
What you need is an AppleScript CGI, which has been set up to return a
snippet of html (rather than a full http response) when accessed via a
server side include. Here is what you would do (I have done this only
with WebSTAR):
<disclaimer>tested while rested</disclaimer>
1) In your html page, include this code
<!-- #exec script="yourscript.acgi" valueToPass="Wow! Just what I
needed!" -->
2) Create a script as follows:
on handle CGI request with posted data posted_data
return posted_data
end handle CGI request
Save is as a classic applet, stay open, never show startup screen. Put
it in the same folder as the above html page.
3) Open the html page (served thru WebSTAR). You should see the
unprocessed value you passed.
There is a bug with AS 1.6 (the update beyond MacOS 9.1) which will
cause this to fail (silently) if the script is not already running.
I cannot make this work with PWS.
Obviously this is a trivial example. You would need to include code
within the handle CGI request block to actually return something useful.
You can pass multiple parameters to the CGI, including your own custom
codes which tell it to respond to either an SSI or a form post.
I have an Applescript CGI SSI which reads a text file and returns the
first line of that file (to get the most recently accessed account
number), for example.
HTML generated by an Applescript CGI cannot itself include an
Applescript CGI SSI (or any SSI or in-line CGI/middleware call). When
html is generated in toto by any app/cgi/plug-in, WebSTAR will simply
serve the html, not process the in-line stuff it might contain.
HTH!
Jeffrey W Baumann, who is wondering why my OSX mail app no longer has a
signatures pop-up.
email@hidden <-- version 3 is still a great way to do email
www.linkedresources.com <-- getting really outdated
On Friday, May 18, 2001, at 04:01 PM, Dennis Wurster wrote:
Hi All,
I'm really ignorant about this, but I'll try to make my question as
intelligent as I can.
Is is possible to 'direct' AppleScript's output to html?
Specifically, for starters, let's say that I want an HTML page that
simply gives the output of the 'current date' function.
Under unix, I'd call a `date` function, but I don't know how (or if it's
possible) with AS.
I don't know if this is considered a 'Server Side Include' or not, as I
said, I'm really ignorant about this.
I've heard that WebStar and Personal Web Sharing can use AS for CGI's...
but my 'AS for the Internet' book only talks about forms and such.
I'm just thinking about ways to expand my AppleScript knowledge.
Thanks,
-=Dennis=-
------------------------
Dennis Wurster
Senior IT Specialist
Infantino Associates
_______________________________________________
applescript-users mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/applescript-users
References: | |
| >AS and SSI (From: Dennis Wurster <email@hidden>) |