Why does this work, but...

#1. This works:

shell> osascript -e ’ say “hello” ’ // I hear the computer say hello.

#2. … but this doesn’t:

TryAS.php
<? system(' osascript -e \' say "hello"\' ' //The server is silent. ?>

My mac-mini is both the client and the server. I’d like to hear “hello” when #2 executes on the server.
There must be some way to config the server so it can execute #2.
Should this should be peer-to-peer? Pls comment.

My Goal: A client can type “hello” into an HTML form and the server (or peer) computer will say hello out loud.

Thanks much.

Model: mac mini
Browser: Firefox 1.0.6
Operating System: Mac OS X (10.4)

hi,

this has something to do with the way that osascrip executes AppleScript. It needs some connection to the WindowManager through with the events sent from the script are routed. You might see some error message related to this when checking your servers error log.

Don’t ask me about specifics, tho, the answer is just the one I got when I asked about this because I had tried the same :smiley:

danB

Model: iBook (g3/800, 14,1")
AppleScript: 1.9.3
Browser: Safari 312
Operating System: Mac OS X (10.3.9)

I finally got it working! In httpd.conf change user (& group) to a user that has terminal connection. E.g. I just changed it to my usual login. Probably for security you want to set up a new user and restrict its permissions.

Thanks again for your help. Your suggestion was a big step along the way. Now I understand a lot more about apache! :smiley: