Search found 319 matches

by Dan Ebberts
September 3rd, 2012, 12:23 pm
Forum: Scripts Discussion
Topic: XML parsing
Replies: 4
Views: 5175

Re: XML parsing

I think it would be .languages.language[0] etc.

Also, sometimes you have to add .toString() to get things to work right.

Dan
by Dan Ebberts
September 2nd, 2012, 11:19 pm
Forum: Scripts Discussion
Topic: XML parsing
Replies: 4
Views: 5175

Re: XML parsing

It's pretty straightforward once you have the file object:

myXmlFile.open("r");
var myXmlString = myXmlFile.read();
var myRoot = new XML (myXmlString);
myXmlFile.close();

There's a chapter on it in the JavaScript Tools Guide.

Dan
by Dan Ebberts
July 23rd, 2012, 4:12 pm
Forum: Expression Discussion
Topic: Is there a way to create masks using expression?
Replies: 2
Views: 4616

Re: Is there a way to create masks using expression?

Expressions can't create masks or access their control points, but you could create a bunch of masks and apply an expression like this to randomly control each mask's Mask Opacity property: minDelay = 0; maxDelay = 5; seedRandom(index,true); myDelay = random(minDelay,maxDelay); time < myDelay ? 0 : ...
by Dan Ebberts
June 27th, 2012, 2:03 pm
Forum: Scripts Discussion
Topic: Trouble linking Slider to a Shape layer parameter
Replies: 2
Views: 3470

Re: Trouble linking Slider to a Shape layer parameter

You need to create the link by setting an expression for the Roundness property that points to the slider. I'd create the expression by hand first, copy it, and paste it into a variable in your script: var myExpr = "(expression goes here); So instead of using .setValue(roundCtrl) you would use .expr...
by Dan Ebberts
June 25th, 2012, 1:04 pm
Forum: Script Tutorials
Topic: FootageItem replace() method
Replies: 10
Views: 16696

Re: FootageItem replace() method

Glad I could help.

I'm still dying to know why you would want to use the item's index rather than its name.

Dan
by Dan Ebberts
June 25th, 2012, 12:12 pm
Forum: Script Tutorials
Topic: FootageItem replace() method
Replies: 10
Views: 16696

Re: FootageItem replace() method

This should give you the item numbers of any selected items.

Code: Select all

{
  for (var i = 1; i <= app.project.numItems; i++){
    if (app.project.item(i).selected){
      alert("Item " + i + " is selected.");
    }
  }
}

Dan
by Dan Ebberts
June 25th, 2012, 11:35 am
Forum: Script Tutorials
Topic: FootageItem replace() method
Replies: 10
Views: 16696

Re: FootageItem replace() method

Unless you have a really good reason for referencing it by number, I wouldn't do it that way. If you can look it up by name, that seems like it would less subject to getting messed up if you add anything to the project. Just go through the project bin looking for a FootageItem with the correct name....
by Dan Ebberts
June 25th, 2012, 6:22 am
Forum: Script Tutorials
Topic: FootageItem replace() method
Replies: 10
Views: 16696

Re: FootageItem replace() method

I just tried it (with different paths of course) and it works for me. You'll get that error though, if item 70 isn't a Footage Item.

Dan
by Dan Ebberts
June 24th, 2012, 10:54 am
Forum: Script Tutorials
Topic: FootageItem replace() method
Replies: 10
Views: 16696

Re: FootageItem replace() method

If "/C/AE cs5 working/Styles/Basic 1.aep" is the project, you have to open it first:

var projFile = new File ("/C/AE cs5 working/Styles/Basic 1.aep");
var myProject = app.open(projFile);

Dan
by Dan Ebberts
June 19th, 2012, 10:41 pm
Forum: Expression Discussion
Topic: reationship between numbers. tring to find solution...
Replies: 1
Views: 4075

Re: reationship between numbers. tring to find solution...

Inverse scaling would be:

s2 = 10000/s1

Dan
by Dan Ebberts
May 15th, 2012, 10:52 pm
Forum: General Scripts Library
Topic: sort to individual folder 1.0b
Replies: 4
Views: 7552

Re: sort to individual folder 1.0b

>Does this mean I do not have to loop through to find the selected items, but can merely summon them and their value?

That's correct.

>Why does this not matter here?

It's pretty much equivalent to your loop. mySelectedItems is an array of items selected at the time the script launched.

Dan
by Dan Ebberts
May 14th, 2012, 4:41 pm
Forum: General Scripts Library
Topic: sort to individual folder 1.0b
Replies: 4
Views: 7552

Re: sort to individual folder 1.0b

I'd do it like this: { var mySelectedItems = app.project.selection; if (mySelectedItems.length > 0){ app.beginUndoGroup("Sort To Individual Folders"); for (var i = 0; i < mySelectedItems.length; i++){ var mySelection = mySelectedItems[i]; var compFolder = app.project.items.addFolder(mySelection.name...
by Dan Ebberts
May 13th, 2012, 12:53 pm
Forum: Expression Discussion
Topic: Move layer based on final position
Replies: 2
Views: 3940

Re: Move layer based on final position

This should work:

tStart = inPoint; // time to start (seconds)
tDur = .5; // time to move
yOffset = 30; // amount to move
ease(time,tStart,tStart+tDur,value+[0,yOffset],value)


Dan
by Dan Ebberts
May 9th, 2012, 10:33 am
Forum: Script requests
Topic: How to set a reference to compositions name instead of index
Replies: 1
Views: 3278

Re: How to set a reference to compositions name instead of i

If you want to find a comp by name, you have to loop through the project items, like this: var theComp = null; var theName = "Put 1st video here"; for (var i = 1; i <= app.project.numItems; i++){ if (app.project.item(i) instanceof CompItem && app.project.item(i).name == theName){ theComp = app.proje...
by Dan Ebberts
April 20th, 2012, 2:46 pm
Forum: Script requests
Topic: Automatically create an elliptical mask
Replies: 1
Views: 6069

Re: Automatically create an elliptical mask

This should add an elliptical mask to the selected layer: myLayer = app.project.activeItem.selectedLayers[0]; ratio = .5523; h = myLayer.width/2; v = myLayer.height/2; th = h*ratio; tv = v*ratio; newMask = myLayer.Masks.addProperty("ADBE Mask Atom"); newMask.maskMode = MaskMode.ADD; myProperty = new...