Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

thriftinkid

macrumors regular
Original poster
Mar 24, 2008
119
0
I know you can write an (if, then) command using applescript. Does anyone know if there is a way to tell automator to stop running a workflow if an applescript from within the workflow get's the proper response back from an (if, then) command. I'm having an applescript run some javascript form within automator. I posted both scripts below. If the response from the javascript result is "You do not have any items set to render.", I want the workflow to stop.

Applescript:

Code:
tell application "Adobe After Effects CS3"
	set sScriptPath to "MacintoshHD:Applications:Adobe After Effects CS3:Scripts:render.jsx"
	DoScriptFile alias sScriptPath
end tell

Javascript:

Code:
	//check the render queue and make certain at least one item is queued
		safeToRunScript = false;
		for (i = 1; i <= app.project.renderQueue.numItems; ++i) {
			if (app.project.renderQueue.item(i).status == RQItemStatus.QUEUED) {
				safeToRunScript = true;
				break;
			}
		}
		if (! safeToRunScript) {
			alert ("You do not have any items set to render.");
		}
	
	
		var myQueue = app.project.renderQueue //creates a shortcut for RQ
		
		// Call render
		myQueue.render();
 

thriftinkid

macrumors regular
Original poster
Mar 24, 2008
119
0
I know you can write an (if, then) command using applescript. Does anyone know if there is a way to tell automator to stop running a workflow if an applescript from within the workflow get's the proper response back from an (if, then) command. I'm having an applescript run some javascript form within automator. I posted both scripts below. If the response from the javascript result is "You do not have any items set to render.", I want the workflow to stop.

Applescript:

Code:
tell application "Adobe After Effects CS3"
	set sScriptPath to "MacintoshHD:Applications:Adobe After Effects CS3:Scripts:render.jsx"
	DoScriptFile alias sScriptPath
end tell

Javascript:

Code:
	//check the render queue and make certain at least one item is queued
		safeToRunScript = false;
		for (i = 1; i <= app.project.renderQueue.numItems; ++i) {
			if (app.project.renderQueue.item(i).status == RQItemStatus.QUEUED) {
				safeToRunScript = true;
				break;
			}
		}
		if (! safeToRunScript) {
			alert ("You do not have any items set to render.");
		}
	
	
		var myQueue = app.project.renderQueue //creates a shortcut for RQ
		
		// Call render
		myQueue.render();

Would it be better to try and add another applescript after that command is given, or would it be best to try and write an if/then script in the first applescript?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.