Looking to write Maya render droplet script (To open up Terminal)

I am looking to create a droplet for Maya (2009 or later) that I can drop a Maya project file on and have it run a Terminal command:

/Applications/Autodesk/maya2009/Maya.app/Contents/bin/Render -r sw 'projectFILE PATH/NAME HERE'

There are different renderers available in Maya, and from third parties, Software, Mental Ray, and Renderman, is what I am using for the most part, so I will stick to that for now.

So I would love to be able to drop a file onto the app, have it open a dialogue box asking which renderer I would like to use, and possibly some other options, that could change the command that will be run in terminal, but always use the path and filename of the file dragged to it.

I am basically trying to replicate actually opening the Terminal application, typing in the proper render commands, then running it, leaving terminal open so I can see the progress of the render.

I am not quite sure to start with this and would just like to get some guidance to get started.

EDIT:

here is the starting point i suppose:

activate application "Terminal"
tell application "System Events"
	set frontmost of process "Terminal" to true
	keystroke "/Applications/Autodesk/maya2009/Maya.app/Contents/bin/Render -r rman -h"
	keystroke return
end tell

this will not really do anything on a machine that doesn’t have Maya 2009 installed, but this is the basic funtionality I need from the droplet, again I want Terminal to actually launch so I will be able to check progress, the main thing I need to get into the Terminal command is the whole file path of the file that is dragged onto the droplet.
Thanks!

Got the basic functionality up and running! wooo!

here is the Renderman version:

on open {droppedfile_path}
	
	--Set the Render File path
	set renderfile_path to the quoted form of (POSIX path of (droppedfile_path as text))
	
	--Set the Render Command 
	set render_cmd to "/Applications/Autodesk/maya2009/Maya.app/Contents/bin/Render -r rman " & renderfile_path
	
	--Launch Render in Terminal
	tell application "Terminal"
		do script with command render_cmd
	end tell
	
	
end open

what I am really looking to do is allowing the user to choose the renderer, so basically the text “rman” could be replaced by a choice of 3-4 renderers, or even a dialogue that pops up after dropping the file asking the user what renderer they would like to use, then another one asking if they would like to add any additional flags to the render.

if anyone could help me with this they will save me hours and hours of my life.

thanks.

FINISHED! short and simple

on open {droppedfile_path}
	
	--This list contains the Maya Renderers
	set renderer_List to {"sw", "mr", "rman", "3delight", "vray"}
	set renderer_choice to item 1 of (choose from list renderer_List with prompt "Choose a Renderer:")
	
	--Ask to enter any additional render flags
	set render_flags to text returned of (display dialog "Enter additional Render Flags for " & renderer_choice & ":" default answer "")
	
	--Set the Render Filename
	set renderfile_path to the quoted form of (POSIX path of (droppedfile_path as text))
	
	--Set the Render Command
	set render_cmd to "/Applications/Autodesk/maya2009/Maya.app/Contents/bin/Render -r " & renderer_choice & " " & render_flags & " " & renderfile_path
	
	--Set the Email Command
	--set mail_cmd to " && osascript /Users/andoru/Projects/developer/applications/pipeline/MayaRender/RenderFinNotification.scpt"
	
	--Launch Render in Terminal
	tell application "Terminal"
		activate
		do script with command render_cmd
	end tell
	
end open

Something else I would definitely be interested in figuring out is how to allow dropping a folder of Maya project files onto the droplet or a selected group of files and have it generate a command similar to this:

“render_cmd1 && render_cmd2 && render cmd3. . . etc.”