Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list
SOLVED

Macro to change font colors (with exeption)

Avatar

Level 2

Hello.

 

When updating my forms, I usually put all changes in red to ensure we know were to look during review.

I would like to use a macro to remove all these red in regular text boxes, field captions, etc. en replace them with black.

Except for text that contain an url link (They should be blue)

How would you do that ?

I guess, finding all "

<fill>
<color value="255,0,0"/>
</fill>"

and remove them unless when url is present then, replace "255,0,0" by a blue color.

 

Not sure how to do that,

 

Can you help ?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Create a text file with following content.

var oNodes = designer.filterNodeTree(xfa.template, "value", "255,0,0");
for (var i = 0; i < oNodes.length; i += 1) {
	oNodes.item(i).value = "0,0,0";
}

Save that file as .js  file (i.e. my Macro.js). 

Create a new folder under the macro folder of you LiveCycle or AEM Forms Designer (i.e. C:\Program Files (x86)\Adobe\Adobe Experience Manager Forms Designer\EN\Macros\MyMacros) and paste you .js file there. 

Open your form in Designer an execute your new macro from [Tools] > [Macros].

1 Reply

Avatar

Correct answer by
Level 10

Create a text file with following content.

var oNodes = designer.filterNodeTree(xfa.template, "value", "255,0,0");
for (var i = 0; i < oNodes.length; i += 1) {
	oNodes.item(i).value = "0,0,0";
}

Save that file as .js  file (i.e. my Macro.js). 

Create a new folder under the macro folder of you LiveCycle or AEM Forms Designer (i.e. C:\Program Files (x86)\Adobe\Adobe Experience Manager Forms Designer\EN\Macros\MyMacros) and paste you .js file there. 

Open your form in Designer an execute your new macro from [Tools] > [Macros].