I will see if this is possible, I have not tried triggering Applescript, will let you know.
Well, triggering an apple script from PHP can be done using a shell script. You place the apple script into a regular shell script and then use the PHP
shell_exec or
exec command with the shell script path to trigger the script. Java script cannot do that since it runs on the computer of the client and has no access to the server.
The shell script to execute some apple script would look similar to this:
#!/bin/sh
#
osascript << EOF
... place apple script here ...
EOF