Launch app script from within another script

I know you can launch one AppleScrip from within another script. I have a slight variation on that that I was wondering about.

I have Quark printing scripts, saved as applications that are set up to accept drag-and-dropped Quark documents in the Finder. Basically it’s a droplet that accepts Quark documents and will open them up and print them.

I created another Quark script that, at the end, I would like to have it print. Rather than copy the code from the print script and put it in the other scirpt, I thought it would be cool if if could call the other script up. That way, if the print script changes for some reason, I only have to change it in the one place.

So, is there syntax to basically say in a script, “take this Quark file and DROP it on the application x”? I am assuming the main script will finish with the Quark document and close it so this should be a Finder procedure I would think. Any ideas?

Quark 6.5 Tiger

Model: G5 Tower (not Intel) - Script Editor ver 2.1.1
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

Hi Matt,

You pass reference(s) to the script app through the open handler. Here’s an example. Suppose this is your droplet:


on open these_files
	-- do something with the files
	activate
	repeat with this_file in these_files
		display dialog (this_file as string)
	end repeat
end open

You call the open handler with this:


set f to choose file -- get a reference to the file
tell application "x"
	launch
	open {f}
end tell

You might get an error if the droplet is not saved a stay open, because it quits automatically when it is done and the calling script is still in the tell block that called it. I save it as stay open. I think that fixes the error.

gl,