Is this possible with AppleScript?
This is the senerio:
- using an internet browser (IE or Safari)
- click on a Flash button with an action script attached to it
- flash action script would activate an AppleScript on the remote osx server
- However, I need the AppleScript to effect the osx server and not my computer
(effect meaning- opening up an application on the osx server)
Is this way out of the ball park? Or is it possible? Or is there a better way of doing it? I defintley need use Flash and AppleScript though.
Apple has a link to URL Protocol Messaging. The first paragraph reads as follows…
So it looks like “Panther” is going to offer a lot more than what catches the eye ;¬)
will that work for what I explained above? :?
You might be able to use Albert by using a mailto tag embedded in a flash button to activate a script on a remote machine. Another option would be to use AppleScript over IP. I haven’t tried either method, but it does seem possible. I’d be careful of security issues in either case though.
The URL Protocol Messaging isn’t your solution… it lets you define new protocol types (e.g. http:// ftp://) that get passed to your script, but the user’s browser has to know how to handle your protocol.
However, all is not lost, what you describe can be very easily handled via AppleScript CGIs.
Write a standard CGI in AppleScript and have your flash animation open a url http://www.yourserver.com/cgi-bin/yourscript.cgi
yourscript.cgi can be any AppleScript-based cgi script and can do anything that AppleScript can do on your server.
Apple have a sample CGI shell you can use as a starting point.
Thanks again Camelot, I’ll give it a shot!
Maybe a dumb question… but how do you create a AppleScript CGI? Using Script Editor? I’m on OS X 10.2.6
- The server is a mac based apache server… do I put the test.cgi file in the Computer>Library>WebServer>cgi-Executables folder?
Alright… Before I go reading AppleScript CGI books, and everything else that has to do with what I wanting to do…
Camelot or someone let me know if this will work.
I have a URL-
- displaytime.cgi would be an AppleScript CGI file that will show a dialog box of the current time on the screen.
So when you click on that link; will that execute displaytime.cgi to open up on the server- and display the time on the server screen?
Yes, that’s entirely possible - with a couple of caveats.
First, if no user is logged in, it’s unlikely that the script will be able to launch any graphical-based apps, so you’ll need to add error checking to your script to make sure you can launch apps, which isn’t a big deal but needs to be said.
Secondly, Mac OS X Server comes pre-built with AppleScript cgi support built in, but the client version doesn’t. To run AppleScript cgi’s on Mac OS X client you’ll need to get a copy of ACGI Dispatcher ($15) from http://www.sentman.com/acgi/index.php
This enables apache to propertly handle AppleScript cgi scripts.
Just tried it out… That has to be the coolest thing i have seen in awhile! :lol:
That will work perfect for me! Thanks again Camelot!
Oki, what program do you use to write a acgi? Script Editor doesn’t seem to save as that. CodeWarrior or bbEdit maybe? Just dont say C or C++ :
.acgi’s are simply compiled scripts with a .acgi filename extension. There’s nothing unusual about them.
Script Editor can write .acgi scripts - as can any OSA Script Editor (Script Debugger, Smile, Scripter, etc.)
The link I posted above can be copied and pasted into a new script as a starting point.