Open file with AppleScript app using a second applet...

I have written an applet called RenderQ that uses on open and on run to define its startup behavior (just showing on open/on run behavior here):

--Set Double-Click behavior. . .
on run
	
	checkForPrefs()
	
	set dropped_items to choose file with prompt "Select the files to render:" of type {"mb", "ma", "nk", "aep", "shk", "c4d"} with multiple selections allowed
	
	RenderQ(dropped_items)
	
end run

--Set drag and drop behavior. . .
on open (dropped_items)
	
	checkForPrefs()
	
	RenderQ(dropped_items)
	
end open

Now, for workflow reasons I am looking for a way of using a second applescript applet/shell script/whatever, that will open a specific file and pass it to RenderQ(dropped_items)

Obviously I can’t just do something like:

tell application "RenderQ"
	
	set posixPath to "/Volumes/Kuro TaNK/ProjectTaNK/sandbox/prman.maya/scenes/teapot_v1.22.ma"
	set filename to (POSIX file posixPath) as alias
	
	open filename
	
end tell

So I am looking for a way to correctly pass the file information into an Application from another application, if that makes any sense. Normally you can do this from the command line:

/pathto/RenderQ.app/Contents/MacOS/RenderQ /pathto/file.ext

But this doesn’t seem to work for me with an AppleScript app. If there is a way change my main RenderQ application so it can be run from the command line as shown above, that would be great.

The reason I want to do this is for remote machine rendering, from a main workstation the user will drag and drop onto RenderQ, it will spit out an applet and store it locally in a RenderQ directory and launch screen sharing to another machine on the LAN.

You can then run an applet on the remote machine that will connect you back to the main workstation’s RenderQ directory where you will be able to double click this applet and open the project file (stored on the main workstation and connected via AFP) in the remote copy of RenderQ.

I am happy to explain more as I know this is a bit odd, but I am pretty confident there must be a way to make this happen. I would be happy to simplify my explanation if necessary. Thanks.

You first need to supply an argument for the “on run” handler. Then you run it from a second script using “run script”. So something like this for your applet…

--Set Double-Click behavior. . .
on run theVar
	checkForPrefs()
	
	if (count of theVar) is greater than 0 then
		RenderQ(theVar)
	else
		set dropped_items to choose file with prompt "Select the files to render:" of type {"mb", "ma", "nk", "aep", "shk", "c4d"} with multiple selections allowed
		RenderQ(dropped_items)
	end if
end run

--Set drag and drop behavior. . .
on open dropped_items
	checkForPrefs()
	
	RenderQ(dropped_items)
end open

on RenderQ(dropped_items)
	return dropped_items
end RenderQ

on checkForPrefs()
	
end checkForPrefs

And something like this for the second script which calls the applet…

set appletPath to (path to desktop as text) & "test applet.app"
run script (appletPath as alias) with parameters {"some list items"}

Nice! Really appreciate it, thanks!

with parameters would be referring to the file paths I want to pass to RenderQ correct?

Yep. Good luck. :smiley: