Expressions/Scripts/Presets

Moderator: Paul Tuersley

 
Aaron_Ecthelion
Topic Author
Posts: 1
Joined: Fri Dec 30, 2016 7:00 am

Can't write to The applyStroke attribute

Fri Dec 30, 2016 7:04 am

I have several lines of simple code like this:
     var myComp = app.project.activeItem;
     var myLayer = myComp.layer(1);
     myLayer.sourceText.value.applyStroke = true;
     alert(myLayer.sourceText.value.applyStroke);
 
 
However, the applyStroke doesn't work properly, I can read its value, but can't write it. According to the official scripting guide, it's read/write.
         
[color=#3a91d7][font=adobe-clean, Helvetica Neue, Arial, sans-serif][img=620x187]https://forums.adobe.com/servlet/JiveServlet/downloadImage/2-9230707-1093526/1.png[/img][/font][/color]
But the 3rd line just doesn't work! I wonder why! Is this a bug? !
Hope I've made myself clear.
 
jordanwade33
Posts: 13
Joined: Mon Dec 08, 2014 11:11 pm

Re: Can't write to The applyStroke attribute

Wed Jan 04, 2017 4:52 pm

I'm not sure if you've already solved this, but I ran into something similar with Markers, so I thought I would share my experience. 

It is read/write, but you need to set the value again after changing it, it doesn't update automatically. If you want to change other attributes (font size, colors, etc.), just change those before the setValue. The code below seems to work, hopefully it makes sense.
var myComp = app.project.activeItem;
var myTextProp = myComp.layer(1).sourceText;
var myText = myTextProp.value;
myText.applyStroke = true;
myTextProp.setValue(myText);

Who is online

Users browsing this forum: No registered users and 4 guests