Re: PHP and Applescript
Re: PHP and Applescript
- Subject: Re: PHP and Applescript
- From: Brian Johnson <email@hidden>
- Date: Sun, 10 Feb 2008 12:56:11 -0800 (PST)
On Sun, 10 Feb 2008, Grace Finn wrote:
On Feb 10, 2008, at 12:06 PM, Brian Johnson wrote:
You can return an http redirect, or a simple HTML page with a javascript
redirect, and use that to load a static HTML page with the form for the
next event. As long as the form is always the same, that should work fine.
I'm not exactly sure how to do that without the browser opening a new window.
This script (let's say it's saved as "turnright.acgi") (saved as stay-open
application without startup screen) will redirect any hit to a static html
page (called 'target'). If you replace the comment about "roboapp" with
*real* AS code to control the robot, then hitting the acgi using <a
href="turnright.acgi"> will cause the robot to turn. If the "target" html
presents all the options, and you have other scripts for "turnleft",
"moveforward" and etc. If it's in one frame or iframe of the page.. it
should work.
property CR : (ASCII character 13)
property lf : (ASCII character 10)
property crlf : CR & lf
property redirect_header : "HTTP/1.0 302 Found" & lf & "Location: "
property OK_header : "HTTP/1.0 200 OK" & lf & "Content-Type: text/html" &
crlf & crlf
property target: "http://your.server.edu/path/controller.html"
on handle CGI request
-- tell application RoboApp to turn right (or whatever)
return redirect_header & target & crlf & crlf
end handle CGI request
on idle
return 60
end idle
As I said, I think I have to look into how to refresh a single frame from
applescript.
the above gets you through one step.
The following works for Safari only:
I think this is confusing and misleading you. You don't want to be telling
safari anything, because you can't count on safari being the browser and
it isn't necessary.
tell application "Safari"
do JavaScript "window.location.reload()" in front document
delay 0
end tell
This works with all but opens a new browser window:
property target_URL : "http://www.mywebsite.com"
open location target_URL
Again, you're working this from the "outside" (as) rather than the
"inside" (the http + html + js side)
Are you using a collection of separate CGIs? (your use of the "right.acgi"
in your form suggests you might have a separate acgi for each action) or
running all the commands through one?
All of the scripts will be separate acgi files for each action the buttons
will be located in the same frame.
OK, if you build them from something like the above script, they should
work. Good luck.
-b.johnson
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden