ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

AE Javascript TextEdit - Question

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Hendrik Vosskamp
AE Javascript TextEdit - Question
on Jun 16, 2017 at 7:48:02 am
Last Edited By Hendrik Vosskamp on Jun 21, 2017 at 12:29:23 pm

Hey guys,

I am pretty new to scripting, but I have a working workflow script which automates my Comp Set up process, by clicking a button which is done with an onClick function. I have everything set up, so that the user can enter e.g. the height and width values for the Comps, however the script only uses the (e.g. 1080) preset values, and does not recognise the user input.

As far as I understand it, I may have to use an onChangefunction, but I can't get it to work properly. Either my Script doesn't work anymore, or it doesn't pay any attention to the onChange. (I tried putting the onChange before the onClick to update my values, but either it doesn't work or the value doesn't leave the function.)

Here's my scrip so far (I have shortened and condensed it considerately).


res = "group{orientation:'column', alignment:['fill', 'fill'], alignChildren:['fill', 'fill'],\
panelOne: Panel{text:'Create SetUp', orientation:'column', alignment:['fill', 'fill'], alignChildren:['100', '100'],\
panelOneCha: Button{text:'CHA'},\
},\
panelTwo: Panel{text:'Comp Settings', orientation:'column', alignment:['fill', 'fill'], alignChildren:['fill', 'fill'],\
staticWidth: StaticText{text:'Width'}, alignment:['fill', 'top'],\
editWidth: EditText{text:'1920'},\
},\
}";

myPanel.grp = myPanel.add(res);

var proj = app.project;
var crtCha = myPanel.grp.panelOne.panelOneCha;

var setWidth = myPanel.grp.panelTwo.editWidth.text;

crtCha.onClick = function(){
var projectName = proj.file.name;

var masterComp = app.project.items.addComp(projectName, parseInt(setWidth), parseInt(setHeight), 1, parseInt(setDur), parseInt(setFPS));


I'd be really grateful for any help ☺

Best regards,
Hendrik

/Edit

I got the answer over at the Adobe Forums. onChanging does the trick.

var setWidth = myPanel.grp.panelTwo.editWidth.text;

myPanel.grp.panelTwo.editWidth.onChanging = function(){
setWidth = myPanel.grp.panelTwo.editWidth.text;
}


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]