Skip to main content
HH_Edin
Inspiring
Sep 20, 2016 6:18 PM UTC
Answered

Using Action Wizard to change font in Combo Box

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 is closed to new replies. Start a new post to keep the conversation going.
George_JohnsonCorrect answer
Inspiring
Sep 20, 2016 7:25 PM UTC

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?

11 replies

Hortie666*
Participating Frequently
Nov 1, 2018 12:22 PM UTC

This script is super helpful! Thanks for sharing!

Translate
Amr.Hamdy
Known Participant
Jul 5, 2017 6:22 PM UTC

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.

Translate
try67
Community Expert
Community Expert
Jul 5, 2017 7:07 PM UTC

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

Translate
Amr.Hamdy
Known Participant
Jul 7, 2017 8:18 AM UTC

I tried now correctly and it's working fine.

the problem was from my side.

thanks for your help.

Translate
Inspiring
Sep 20, 2016 6:33 PM UTC

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.

Translate
HH_Edin
HH_EdinAuthor
Inspiring
Sep 20, 2016 7:15 PM UTC

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";

}

}

Translate
George_JohnsonCorrect answer
Inspiring
Sep 20, 2016 7:25 PM UTC

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?

Translate