Re: Launching an AppleScript from a Local Browser Page
Re: Launching an AppleScript from a Local Browser Page
- Subject: Re: Launching an AppleScript from a Local Browser Page
- From: Gnarlodious <email@hidden>
- Date: Tue, 13 Jul 2004 11:08:31 -0600
It's a lot of work. You have to run Apache which is included in X. Then you
need an application called "ACGI Dispatcher".
Server 10.2 includes ACGI but not the consumer version.
---- Forwarded Message
From: Heinrich Bjerregaard <email@hidden>
Date: Mon, 29 Dec 2003 16:37:47 +0100
To: email@hidden
Cc: Nelson Byrne <email@hidden>
Subject: Re: AppleScript CGI
For app a year ago I was quite frustated of getting AppleScripts to
work from Apache whether using a server or not, so I will just repost
my suggestion:
Date: fre jan 24, 2003 11:43:28 Europe/Copenhagen
To: email@hidden
Subject: Applescript called via Apache CGI
I am writing this because I have used too many hours to figure out how
to access my Applescripts through the Apache CGI.
First I want to thanks Karl Kuehn, which provided me with valuable
information.
Platform: G4 PB with MaxOS X 10.2.3.
1) If you are using BBEDIT as editor remember to set the line-break
style to UNIX. With BBEDIT it's possible to edit files owned by the
root!
2) Since Applescript execution need windows, Apache must run as a
logged in user, so make a user 'web' with almost no rights, and change
the /private/etc/httpd/httpd.conf file accordingly
User web
Group www
In a terminal window restart Apache by: sudo apachectl restart
3) I have named the shell-script:
/Library/WebServer/CGI-Executables/AppleScriptCGI, and it has the
following contents:
#!/bin/sh -i
set -f # disable filename globbing
echo Content-type: text/html
echo
echo "<html>"
echo "<head>"
echo "<title> Test Applescript via Apache</title>"
echo "</head>"
echo "<body>"
echo 'tell application "Aleph0Lib" to return
TestApacheCGI("'"$SERVER_SOFTWARE"'","'"$QUERY_STRING"'")' | osascript
echo "</body>"
echo "</html>"
The procedure TestApacheCGI of the Aleph0Lib script simply returns the
value of its two parameters.
Be aware of how delicate the quoting is.
The shell-script file must have its execution-bits set -- do this via a
terminal window or by using the program Get Info from Gideon Softworks.
Note, if Aleph0Lib is not running it will be started by the shell.
4) The html-form contains:
<FORM ACTION="/cgi-bin/AppleScriptCGI" METHOD=GET name=HdlForm >
<INPUT TYPE=hidden NAME="-Script" VALUE="InstallPic">
<INPUT TYPE=hidden NAME="-Func" VALUE=1>
<INPUT TYPE=hidden NAME="-Company" VALUE="1049">
<INPUT TYPE=hidden NAME="-Lang" VALUE=Dansk>
<INPUT TYPE=submit NAME="egon" VALUE="Install">
</FORM>
5) In Safari the page with the FORM above is loaded by
http://127.0.0.1/test-acgi.htm, and a click on the Install button gives
the following result page:
P1=Apache/1.3.27 (Darwin) mod_perl/1.26
P2=-Script=InstallPic&-Func=1&-Company=1049&-Lang=Dansk&egon=Install
---
Have fun
Heinrich
On 28/12-2003, at 22.10, email@hidden
wrote:
>
Message: 13
>
To: email@hidden
>
From: Nelson Byrne <email@hidden>
>
Subject: AppleScript CGI
>
Date: Sun, 28 Dec 2003 11:53:08 -0800
>
>
On web page
>
http://www.apple.com/applescript/guidebook/sbrt/pgs/sbrt.12.htm there
>
is an example of linking an AppleScript application to a web page.
>
>
I tried doing exactly what they said, but had two problems.
>
>
1) The page says to save the AS with name "test.cgi", location "Sites",
>
file format "application", Option Stay Open.
>
>
But that's not possible: when I try I get an error popup that says "You
>
cannot save this document with extension '.cgi' at the end of the name.
>
The required extension is '.app'. You can choose to use both, so that
>
your file name ends in '.cgi.app'."
>
>
I chose both. This caused another problem in that the HTML (copied from
>
the same page) calls for the name to be "test.cgi", so I changed the
>
HTML to point to "test.cgi.app".
>
>
When I access the HTML from Safari I see a cute little gadget with a
>
list that lets me pick one of a few colors. When I do so, though, I get
>
a page that says
>
>
"Method Not Allowed
>
>
The requested method POST is not allowed for the URL
>
/~xxx/test.cgi.app. (where xxx is my ID)
>
>
So what am I doing wrong?
>
>
OS 10.3.2
>
>
Regards,
>
>
Nelson Byrne
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
------ End of Forwarded Message
Entity revDAVE spoke thus:
>
Is it possible to launch a locally stored AppleScript ( most likely saved
>
as an application - ( let's say on the desktop or wherever)) from a
>
Web-page (Also stored locally)
>
>
- if so - how would you create the HTML code to trigger the AppleScript?
>
What would link look like?
>
>
-something like...?...
>
>
file://localhost/Volumes/drive1/folder1/folder1/(myApp or myFolder or myFile
>
etc????)
>
Or
>
afp://user:email@hidden/myFolder/(myApp or myFolder or myFile
>
etc????)
>
>
...hmmm?...
>
>
--
>
Thanks - RevDave
>
email@hidden
>
[db-lists]
>
>
Check out some great Domain Names at:
>
http://www.domains4days.com
>
_______________________________________________
>
applescript-users mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/applescript-users
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.