Highlighted

Text Expression Source text

New Here ,
May 03, 2020

Copy link to clipboard

Copied

Hi,

 

I have 2 Text layers (Layer A & Layer B) Layer A has a Text and Layer B needs to get the same Text plus the complete Style from Layer A and then I need just the first 2 Characters from it. I tryed a substring Expression but I didn't find  a way to get the style at the same time.

 

is there a way to get both?

Topics

Expressions

Views

623

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Text Expression Source text

New Here ,
May 03, 2020

Copy link to clipboard

Copied

Hi,

 

I have 2 Text layers (Layer A & Layer B) Layer A has a Text and Layer B needs to get the same Text plus the complete Style from Layer A and then I need just the first 2 Characters from it. I tryed a substring Expression but I didn't find  a way to get the style at the same time.

 

is there a way to get both?

Topics

Expressions

Views

624

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
May 05, 2020

Copy link to clipboard

Copied

Can you post what you've tried so far? Might be easier to diagnose where you've gone wrong vs trying to solve your problem from scratch.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
May 05, 2020

Copy link to clipboard

Copied

This is me taking a guess at your intentions, since I'm not entirely sure if this is what you're after.
The short answer is yes, you can get both the style and the actual entered text. I know it's not quite as helpful as we might like, but there is documentation available on these text expressions here


Does this accomplish what you're trying to do?

var mySource = pickwhip to your other text layer ;
var myStyle = mySource.style;
myStyle.setText(mySource.slice(-2))


Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
May 05, 2020

Copy link to clipboard

Copied

Start with the expression directly from the Expression Language menu Text section:

 

style = thisComp.layer("source layer name").text.sourceText.getStyleAt(0,0)
style.setText(thisComp.layer("source layer name").text.sourceText);

 

All that is left is to add the slice operator to sourceText and specify the number of characters:

 

style = thisComp.layer("source layer name").text.sourceText.getStyleAt(0,0);

chr = style.setText(thisComp.layer("source layer name").text.sourceText.slice(0, 2));

 

That should do it. All you have to do is enter the appropriate "source layer name" in both lines or define the layer using a variable. If the layer you want to have the first two characters of the master layer is always below the source layer you could write the expression like this:

mstr = thisComp.layer(index + 1);
style = mstr.text.sourceText.getStyleAt(0,0);
chr = style.setText(mstr.text.sourceText.slice(0, 2));

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
May 06, 2020

Copy link to clipboard

Copied

Hi sorry to bother you, 

Does anyone know if the font Helvetica is licensed to be used commercially ?

Thanks

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
May 05, 2020

Copy link to clipboard

Copied

Thanks @ all...

 

I figured it out myself yesterday but realy big Thanks 😉

I'm using now:

style = thisComp.layer("Master Text").text.sourceText.getStyleAt(0,0);

style.setText(thisComp.layer("Master Text").text.sourceText.substring(0,2))

which is essential the same U all Postet 😉

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...