Edit Original

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
User avatar
lloydalvarez
Enhancement master
Posts: 460
Joined: June 17th, 2004, 9:27 am
Location: New York City, NY
Contact:

Is there a way to invoke "Edit Original" in a script?
tolga
Posts: 1
Joined: May 23rd, 2006, 3:23 pm

BridgeTalk works like a bliss for this. I have no idea why it's not documented in ae scripting guide. An example could be this (it's also applying the changes to the source file, saving it and closing it.):

Code: Select all

function sendTwoToAI(srcName, shwTitle1, shwTitle2){
	
	var sourceNameLcl = srcName;
	var showTitleLcl1 = shwTitle1;
	var showTitleLcl2 = shwTitle2;
	var targetApp = BridgeTalk.getSpecifier("illustrator", "12");
	if(targetApp){
		bt2 = new BridgeTalk;
		bt2.target = "illustrator";
		bt2.body = "var stf2 = new File('"+sourceNameLcl+"'); app.open(stf2); var nam2 = '"+showTitleLcl1+"';  
                   var nam1 = '"+showTitleLcl2+"';
                   app.activeDocument.textFrames[0].contents = nam1;
                   app.activeDocument.textFrames[1].contents = nam2;
                   app.activeDocument.save(); app.activeDocument.close();";
		bt2.send();
		bt2.onResult = writeLn("sent message successfully");
		while(flag){
			clipList[1].layer("typsource").source.mainSource.reload();
			clipList[1].layer("typsource 2").source.mainSource.reload();  
			newWidth = clipList[numberOfLines-1].layer("typsource").width;
			timeOut++;
			if(newWidth!=oldWidth){
				flag = 0;
			}
			if(timeOut >=250){
				flag = 0;
				writeLn("timeout");
			}
		}
	}
}
The trick is to send the message in a string. Good thing is you have access to the target application's document object model. And the getSpecifer method checks if cs2 is installed. Not sure if BridgeTalk would work with CS though, since, as far as i remember, Bridge was introduced with CS2.

The while loop is just a rudimentary time out thing to reload the changed footage automatically. Simply because i haven't figured out a callback from illustrator. It would not be a bad idea to bring up a dialog box that asks the user to switch to the target application, and when they come back, they hit ok and you would have a way to keep track of illustrator's actions.

As far as "edit original" goes, one can easily figure out the type of the footage to be edited and dynamically change the target of bridgeTalk object.

Oh and this is my first post, so hello everybody. Great forum...
Post Reply