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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Auto check if app is running across network Pinksteady Mac Programming 2 Oct 20, 2011 06:53 PM
How can I set up an automation to run a specific program and THEN assign a hotkey? eroxx OS X 1 May 12, 2011 08:45 PM
Running a Command on Shut Down gtr053 OS X 2 Feb 9, 2011 02:59 PM
If Then Programmer iPhone/iPad Programming 6 Sep 1, 2009 05:16 PM
Why does Objective C not have simple if/then and simple loops begdev Mac Programming 7 May 19, 2009 08:05 AM


All times are GMT -5. The time now is 02:01 PM.

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

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