Skip to main content
sangeethak65390815
Known Participant
June 16, 2017
Answered

change CheckBox Appearance

  • June 16, 2017
  • 2 replies
  • 2120 views

Hi,

     I'm using indesign cs6. I want change the checkBox states of Normal On to Normal Off state using indesign scripting. I'm trying more but i can't find it. Pls guide me.

var mySelect=app.selection[0]

var str=mySelect.states;

for(var i=0;i<str.length;i++)

{

    if(str.name=="Normal On")

    {

    str.statetype==StateTypes.DOWN_ON,1181970022

    }

}

Thus, the above code was I'm tried,

The following Image is Require Output

The following Image is given Input

Thanks,
Sangeetha.K

This topic has been closed for replies.
Correct answer Laubender

Hi Sangeetha,
from your discription I'm not sure what you mean.

Ask yourself: How would I achieve my goal when using InDesign's user interface.
Can you describe that before we get to the scripting part?

Do you want to change the active state?

Like that:

A checkbox done in the UI like the one you are showing:

Duplicated that checkbox and set the first state of the selection with: active = true

That will only change what you see in the layout.
If you export both checkboxes to PDF Interactive the behaviors of both checkboxes will be the same.

Regards,

Uwe

2 replies

LaubenderCommunity ExpertCorrect answer
Community Expert
June 19, 2017

Hi Sangeetha,
from your discription I'm not sure what you mean.

Ask yourself: How would I achieve my goal when using InDesign's user interface.
Can you describe that before we get to the scripting part?

Do you want to change the active state?

Like that:

A checkbox done in the UI like the one you are showing:

Duplicated that checkbox and set the first state of the selection with: active = true

That will only change what you see in the layout.
If you export both checkboxes to PDF Interactive the behaviors of both checkboxes will be the same.

Regards,

Uwe

Community Expert
June 19, 2017

Why did I states[0] and not states[1] ?
The UI is not reflecting the stacking order of states with scripting.

Stacking order of states of a Check Box with scripting from my German InDesign CS6:

As you can see from the locale independent names of the states and the statetype, on and off are switched.

/*

    0    Normal - Aus    $ID/$$$/StateType/NormalOff    StateTypes.UP_OFF

    1    Normal - Ein    $ID/$$$/StateType/NormalOn    StateTypes.UP_ON

    2    Cursor darüber - Aus    $ID/$$$/StateType/OverOff    StateTypes.ROLLOVER_OFF

    3    Cursor darüber - Ein    $ID/$$$/StateType/OverOn    StateTypes.ROLLOVER_ON

    4    Klicken - Aus    $ID/$$$/StateType/DownOff    StateTypes.DOWN_OFF

    5    Klicken - Ein    $ID/$$$/StateType/DownOn    StateTypes.DOWN_ON

*/

Regards,
Uwe

Steve Werner
Community Expert
Community Expert
June 16, 2017

Moving to InDesign Scripting forum

sangeethak65390815
Known Participant
June 19, 2017

I find out the answer

app.selection[0].activeStateIndex=0

If I change the activeStateIndex vaule means it will move to next level of the "Normal off".

Community Expert
June 19, 2017

Hi Sangeetha,

I'm not sure, if you read my two posts before…

// checkBox selected:

app.selection[0].activeStateIndex=0

is the same as:

// checkBox selected:

app.selection[0].states[0].active = true;

Glad it is working for you now.

Would you mark your own answer as "Correct" please.

Thanks,
Uwe