Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Apr 30, 2008, 11:48 AM   #1
thriftinkid
macrumors regular
 
Join Date: Mar 2008
If, Then automator command

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 is offline   0 Reply With Quote
Old May 1, 2008, 09:15 AM   #2
thriftinkid
Thread Starter
macrumors regular
 
Join Date: Mar 2008
Quote:
Originally Posted by thriftinkid View Post
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?
thriftinkid is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Remap command q to command h and vice versa? TheArgonaut OS X Mavericks (10.9) 1 Jan 29, 2014 09:08 AM
General: iOS7 command line... Equivalent of "say" command? RobertoG Jailbreaks and iOS Hacks 0 Jan 19, 2014 05:05 PM
Using Automator to play audio file from within Automator made application? nobodyhome OS X 10.8 Mountain Lion 0 Jan 14, 2014 03:23 PM
Need help with Automator tawcat Mac Basics and Help 3 May 4, 2013 10:57 AM
Automator nefan65 Mac OS X 10.7 Lion 0 Jun 26, 2012 04:45 PM

Forum Jump

All times are GMT -5. The time now is 05:32 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC