Simple Move script

What I want is simply to drive FreeHand to fill in a few blanks in a document with inputs from web pages.

Is it possible to call applescript with GUI from Apache (user:www)? I can’t get it working. Any pointer? Thanks a ton!

You can take a look at this tip I posted or, if you’re willing to spend some money, check out acgi dispatcher.

Jon

Thanks a lot jonn8.

However, it is not what I am looking for. I have a thread in this board which is very similar to what I am trying to do:
http://bbs.applescript.net/viewtopic.php?t=5490

I have tried the all the comments from them but I still cannot get it working.

for example, for this simple codes on a php file:

<?PHP
echo "<pre>n";
exec("open /users/aaa/Sites/t.app", $out);
var_dump($out);
echo "</pre>";
?>

and the content of the t.app is:

display dialog "working" default answer ""

i cannot get it shows a dialog when someone trying to get the php page from the apache running on my Mac. The resulting page looks like this:

array(0) {
}

What should I do to correct it? Thanks in advance!

Further information:

when i type the following command in terminal, it does what I want and no line was outputted in terminal:

% open /users/janus/Sites/t.app

Further info:

I have checked the permission on t.app, it is 0755 which should be fine.

And I am working on the Mac which the Apache is running; therefore, there is an active Windows Manager and login section.

I have an interesting workaround to your problem that I have been using. I don’t know if it will work for your situation though. What I have been doing is using PHP (or PERL or whatever) to create a little text file that is dropped into a specified folder. Once this occurs I have a script that runs as an agent and checks the specified folder for text files. If it finds any, it will open them up read the data from them and perform any number of applescripts with the data provided. Just so you know the first line of any text file contains the name of the applescript which is loaded as a script object, all the other data is then fed into that script object. Here is the code for my Script Server!


on idle
	try
		tell application "Finder"
			with timeout of 86400 seconds
				--check the public drop box for any files every minute
				set added_items to every file of folder ¬
					"Macintosh HD:Users:appserver:Public:Drop Box" whose file type is "TEXT"
				if added_items is not {} then
					--if there are any files in the drop box, process them
					repeat with an_item in added_items
						set target_file to (an_item as alias)
						--set up a blank list to hold data for the target script
						set import_record to {}
						--open the text file and read all it's data
						set open_document to open for access target_file
						set current_data to read open_document
						close access open_document
						move target_file to trash
						set standard_delimiters to AppleScript's text item delimiters
						try
							--explode each line of the text file into a list item
							set AppleScript's text item delimiters to return
							--the first line of the text file is the name of the script object to load
							set script_variable to text item 1 of current_data
							set record_count to count text items of current_data
							--copy every other line of the text file into a list of variables
							repeat with i from 2 to record_count
								copy text item i of current_data to the end of import_record
							end repeat
							set AppleScript's text item delimiters to standard_delimiters
						on error
							set AppleScript's text item delimiters to standard_delimiters
							display dialog "There was an error"
						end try
						try
							--load the script object into the ScriptServer
							set ApplicationHandler to ¬
								load script file ("Macintosh HD:Script Libraries:" & script_variable)
						on error error_message
							activate
							display dialog error_message giving up after 30
						end try
						try
							--activate the script object and feed it the list of variables
							tell ApplicationHandler
								ActivateScript(import_record)
							end tell
						on error error_message
							activate
							display dialog error_message giving up after 30
						end try
					end repeat
					empty trash
				end if
			end timeout
		end tell
	on error error_message
		display dialog error_message giving up after 600
	end try
	return 60
end idle