Copy link to clipboard
Copied
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
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
Copy link to clipboard
Copied
Moving to InDesign Scripting forum
Copy link to clipboard
Copied
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".
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Really sad to see you gave the correct answer mark to Steve
Copy link to clipboard
Copied
Hi Laubender,
Actually I am new to this forum. I don't know how to i mark it as its correct. Please can you teach me.
Copy link to clipboard
Copied
Unmark Steve's post—sorry, Steve ;-)—and mark the other post as correct.
Hope, this helps.
Uwe
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Hi! I do not have very much experience using scripts. I want to change all the checkboxes in my interactice document from "normal on" to "normal off" at once - otherwise going through and selecting each checkbox individually and changing their default to "normal off" would take waaaaay too much time (it's for a very long workbook).
Is there a way someone could share the code used to run such a script for the latest version of indesign?