AppleScript

The Windows version of Adobe After Effects Render Engine has the ability to start via command line with the option -wp to specify a working path during start. If you like to use this option i.e. as render cluster on Apple OS X you can use the following AppleScript.

-- Mounts a Volume and starts Adobe After Effects with the mounted working path
--
-- © 2011 Ph. Schellworth
-- www.schellworth.de
--
 
 
property usrn : "user"
property pswd : "secret"
 
set serv to "192.168.0.1"
set vol to "shared_volumes"
 
property RenderPath : "/Volumes/shared_volumes/watch_folder/" --POSIX path to wath folder
 
 
 
--Check if UI Settings are enabled
GUIScripting_status()
 
--mount volume
if MountVolume(serv, usrn, pswd, vol) then
	if ApplicationIsRunning("After Effects") then
		--activte Render Server
		StartRenderServer(RenderPath)
	else
		--start "After Effects Render Engine" than activate the watch folder
		try
			tell application "Adobe After Effects Render Engine" to activate
		end try
		StartRenderServer(RenderPath)
	end if
else
	display dialog "mount false"
end if
 
 
 
 
 
 
 
on MountVolume(Srv, SrvUser, SrvPswd, SrvVol)
	if my pingServer(Srv) then
		if SrvVol is not in (list disks) then
			try
				mount volume "afp://" & SrvUser & ":" & SrvPswd & "@" & Srv & "/" & SrvVol
			on error
				display dialog "Can't mount Server \"" & Srv & "\"!" with icon stop giving up after 20
				return false
			end try
			--check again
			if SrvVol is in (list disks) then
				return true
			else
				display dialog "Volume \"" & SrvVol & "\" isn't available!" with icon stop giving up after 20
				return false
			end if
		else
			--Volume's already mounted
			return true
		end if
	else
		display dialog "Server \"" & Srv & "\" isn't available! Check network connectivity." with icon stop giving up after 20
		return false
	end if
end MountVolume
 
 
on pingServer(ServerIP)
	try
		do shell script "ping -t2 -c1 " & ServerIP
		return true
	on error
		return false
	end try
end pingServer
 
 
on StartRenderServer(POSIXPath)
	tell application "System Events" to set watch_window to (get the title of every window of every process where name is "Überwachter Ordner")
	-- check if it's still running to prevent close.
	if watch_window then
		return false
	else
		do_menu("After Effects", "Ablage", "Überwachter Ordner...")
		tell window 1
			tell application "System Events"
				keystroke "g" using {shift down, command down}
				keystroke POSIXPath
				delay 1
				keystroke return
				delay 1
				keystroke return
			end tell
		end tell
		return true
	end if
end StartRenderServer
 
on ApplicationIsRunning(appName)
	tell application "System Events" to set appNameIsRunning to exists (processes where name is appName)
	return appNameIsRunning
end ApplicationIsRunning
 
on GUIScripting_status()
	-- check to see if assistive devices is enabled
	tell application "System Events"
		set UI_enabled to UI elements enabled
	end tell
	if UI_enabled is false then
		tell application "System Preferences"
			activate
			set current pane to pane id "com.apple.preference.universalaccess"
			display dialog "This script utilizes the built-in Graphic User Interface Scripting architecture of Mac OS x which is currently disabled." & return & return & "You can activate GUI Scripting by selecting the checkbox \"Enable access for assistive devices\" in the Universal Access preference pane." with icon 1 buttons {"Cancel"} default button 1
		end tell
	end if
end GUIScripting_status
 
-- http://hints.macworld.com/article.php?story=20060921045743404
on do_menu(app_name, menu_name, menu_item)
	try
		-- bring the target application to the front
		tell application app_name
			activate
		end tell
		tell application "System Events"
			tell process app_name
				tell menu bar 1
					tell menu bar item menu_name
						tell menu menu_name
							click menu item menu_item
						end tell
					end tell
				end tell
			end tell
		end tell
		return true
	on error error_message
		return false
	end try
end do_menu
Enter your comment. Wiki syntax is allowed:
   __ __     __   ____   ____ ______
  / //_/ __ / /  / __/  / __//_  __/
 / ,<   / // /  _\ \   / _/   / /   
/_/|_|  \___/  /___/  /_/    /_/