Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

zbotnik

macrumors newbie
Original poster
Aug 10, 2010
5
0
Hi all,

I have a php page that, when loaded, executes an applescript like this:

PHP:
exec('osascript "/bs2.scpt"');

It executes fine, but ones the script has started, and is actually running, I'm prompted for my password, just before the applescript is supposed to do a keystroke via "system events". So the first part of the applescript, which loads a web page, is not affected by this.

Any ideas how I can avoid this? The webserver is on my own computer, so there's nothing fishy going on!

Edit: Oh, and the password prompt details says that it's "osascript" that needs the rights to "com.apple.OpenScripting.additions.se"
 
I've never looked into something like this but maybe you need to give the user defined to run the webserver executing permissions for osascript ?
 
I've never looked into something like this but maybe you need to give the user defined to run the webserver executing permissions for osascript ?

Might be worth a shot. Any idea how I would do that? I've tried editing the sudoers file, but it hasn't helped. And, would that be the same user running the process httpd? Just in case it isn't the same as the one owning the XAMPP (server) app.
 
Might be worth a shot. Any idea how I would do that? I've tried editing the sudoers file, but it hasn't helped. And, would that be the same user running the process httpd? Just in case it isn't the same as the one owning the XAMPP (server) app.

Same user that runs the httpd process, should just be a simple case of chmod-ing and chowning the osascript binary accordingly.
 
Problem solved. I got around this by first calling a script that uses Applescript Runner to call the next script, like this:

Code:
on run {sourcefile}
	tell application "AppleScript Runner"
		do script sourcefile
	end tell
end run

executed by using "osascript activatingscript.scpt sourcescript.scpt"
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.