• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CGI Applescript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CGI Applescript


  • Subject: Re: CGI Applescript
  • From: Heinrich Bjerregaard <email@hidden>
  • Date: Sat, 24 Jul 2004 13:22:04 +0200

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 24/7-2004, at 7:00, email@hidden wrote:

>
> I realise that this is not a direct Studio Question, apologies,
> although I'm in desperate need of help! and you guys have always been
> so helpful and friendly!
>
> Short story....
> Can Panther (NOT Server) run Applescript CGI scripts?
>
> Does anyone know how to do this...?
>
> My understanding is that Apple do not support it on Panther, although
> there is a way to do it.. (Because it IS running Apache)
>
> Anyone...?
>
> thanks in advance...
>
> Wayne Melrose
_______________________________________________
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.


  • Prev by Date: Privileged shutdown
  • Next by Date: Re: Privileged shutdown
  • Previous by thread: Re: Making folders and files as non-admin user [WAS: Re: Privileged shutdown]
  • Next by thread: existence and addressing of smb mounted volume
  • Index(es):
    • Date
    • Thread