Skip to main content
HH_Edin
Inspiring
September 20, 2016
Answered

Using Action Wizard to change font in Combo Box

  • September 20, 2016
  • 3 replies
  • 2860 views

Acrobat Pro DC on a MAC running OS X 10.11.6

I have a form that is mainly set up in Indesign (it works for us - I know others prefer to set forms up purely in Acrobat).

I have a script I can run via Action Wizard (execute a javascript) to change the font in all the text form fields. But being a script-novice I can't figure out how to create a similar script which will change the font used by Combo Boxes (created in Indesign). Can this be done by a script?

I know I can do it manually via Properties but if anyone can give me a pointer to figure out how to do it with a script that would be amazing!

Thank you

This topic has been closed for replies.
Correct answer George_Johnson

The script can be changed to:

for (var i = 0; i < numFields; i++) {

    var f = getField(getNthFieldName(i));

    if (f.type === "text" || f.type === "combobox") {

        f.textFont = "Arial";

        f.textSize = "10";

    }

}

But now I have to ask, what are your reasons for using Arial instead of Helvetica?

3 replies

Hortie666*
Participating Frequently
November 1, 2018

This script is super helpful! Thanks for sharing!

Amr.Hamdy
Known Participant
July 5, 2017

Dear George_Johnson the code you provide is not working correctly, i test it in the console and it shows the message that there is an error.

SyntaxError: syntax error

1:Console:Exec

undefined

Could you please let me know the best way to run this script or check it at your side again?

waiting for the reply as I have the same issue here.

try67
Community Expert
July 5, 2017

The code above is fine. Did you edit it in any way?

Amr.Hamdy
Known Participant
July 7, 2017

I tried now correctly and it's working fine.

the problem was from my side.

thanks for your help.

Inspiring
September 20, 2016

Yes, it can be done with the same script you're using for text fields. If you post the script, I can suggest a change you can make.

HH_Edin
HH_EdinAuthor
Inspiring
September 20, 2016

Thank you - very appreciated!

I'm using:

/* Convert all text fields to 10pt Arial */

for (var i = 0; i < this.numFields; i++) {

    var fname = this.getNthFieldName(i);

    if (this.getField(fname).type == "text") {

        this.getField(fname).textFont = "Arial";

  this.getField(fname).textSize = "10";

}

}

George_JohnsonCorrect answer
Inspiring
September 20, 2016

The script can be changed to:

for (var i = 0; i < numFields; i++) {

    var f = getField(getNthFieldName(i));

    if (f.type === "text" || f.type === "combobox") {

        f.textFont = "Arial";

        f.textSize = "10";

    }

}

But now I have to ask, what are your reasons for using Arial instead of Helvetica?