If, Then automator command

Discussion in 'Mac Programming' started by thriftinkid, Apr 30, 2008.

  1. macrumors regular

    Joined:
    Mar 24, 2008
    #1
    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();
     
  2. thread starter macrumors regular

    Joined:
    Mar 24, 2008
    #2
    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?
     

Share This Page