• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

Interactive button list

Enthusiast ,
Feb 27, 2017 Feb 27, 2017

Copy link to clipboard

Copied

Hello folks,

I have an ID doc that is used with Publish Online.  It contains a fairly large number of buttons.

Is there any way to reorder or sort the list in the Show/Hide function's visibility list?

Views

4.3K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 27, 2017 Feb 27, 2017

Copy link to clipboard

Copied

It appears to behave as following in the order in which they were created in the first place. Layers and stacking order don't seem to change the matter.

Mike Witherell

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 27, 2017 Feb 27, 2017

Copy link to clipboard

Copied

One thing I do is plan to use an alphabetical progression of names and numbers, keeping them short, and not using spacebar spaces ... as if I were writing code.

Mike Witherell

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 27, 2017 Feb 27, 2017

Copy link to clipboard

Copied

Hi,

the order of the buttons listed is in creation order on the spread.

What you could do is:

1. Do a backup of the document.


2. Add a new spread and move all buttons to the new spread:

To do that zoom out to see both spreads. Then drag the buttons accross the border to the new spread.

That will not change their names.

3. Move the buttons back in the order you like to see them stacked.

Do not cut/paste the buttons.

Do not copy/paste the buttons.

Good luck with that…

Regards,
Uwe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 27, 2017 Feb 27, 2017

Copy link to clipboard

Copied

Warning:

If the buttons are nested to other objects:

1. Anchored with text frames

2. Be part of multistate objects

3. Are grouped with other buttons or other elements

4. Were pasted inside graphic frames

5. Are part of table cells

the task can get very nasty and you better forget about reordering.
And you will probably lose some properties on them if you try to ungroup or move them out of the nested structures.

Rule number 1:
Avoid at all cost cut/paste and copy/paste.

Regards,
Uwe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 27, 2017 Feb 27, 2017

Copy link to clipboard

Copied

Hi Joe,

what is your preferred order?
Alphabetically?

And is EVERY button you want to reorder unnested?
Means: Is not part of a group, is not anchored etc.pp.?

Then you could use the ExtendScript script below to move buttons around.

The script will temporarily create a new spread, move all buttons to the temp spread and will move them back in alphabetically order of their names.

Screen before running the script.
List is unordered.

1-MoveButtonsToAlphabeticalOrder-BEFORE-SCRIPTACTION.png

Screen after running the script.
List is in alphabetical order.

If your button names contain numbers at the beginning of their names we have to rethink the sort algorithm a bit…

2-MoveButtonsToAlphabeticalOrder-AFTER-SCRIPTACTION.png

Script code in ExtendScript (JavaScript).

Tested with InDesign CC 2014.2.

Important note: I am not sure if the internal name of the panel is different in other versions of InDesign.
If yes the script will throw an error.

Then lines 33, 57 and 61 should be commented out.

And you have to close and reopen the panel yourself to get a refresh of the order of buttons after running the script.

Select one single button on the page and run the script.

// moveButtonsToAlphabeticalOrder_ONE-BUTTON-SELECTED.jsx

// Uwe Laubender

/**

* @@@BUILDINFO@@@ moveButtonsToAlphabeticalOrder.jsx !Version! Mon Feb 27 2017 23:35:27 GMT+0100

*/

app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;

app.doScript

    (

   

    moveButtonsToAlphabeticalStackingOrder,

    ScriptLanguage.JAVASCRIPT,

    [],

    UndoModes.ENTIRE_SCRIPT,

    "Move buttons of spread to ALPHABETICAL stacking order | SCRIPT"

   

    );

function moveButtonsToAlphabeticalStackingOrder(){

    if(app.documents.length == 0){return};

    if(app.selection.length != 1){return};

    if(app.selection[0].constructor.name != "Button"){return};

    if(app.selection[0].parent.constructor.name != "Spread"){return};

   

    var doc = app.documents[0];

    var selectedButton = doc.pageItems.itemByID(app.selection[0].id);

    doc.layers.everyItem().locked = false;

   

    var panelStates = app.panels.itemByName("$ID/$$$/Panel/States");

    var targetSpread = app.selection[0].parent;

    var tempSpread = doc.spreads.add( LocationOptions.AFTER , targetSpread );

   

    var buttonsOnSpread = targetSpread.buttons.everyItem().getElements();

    var buttonsOnSpreadLength = buttonsOnSpread.length;

    var buttonNames = [];

    for(var n=0;n<buttonsOnSpreadLength;n++)

    {

        buttonNames[buttonNames.length++] = buttonsOnSpread.name;

    };

    buttonNames.sort();

    targetSpread.buttons.itemByRange(0,-1).locked = false;

    targetSpread.buttons.itemByRange(0,-1).move(tempSpread);

    for(var n=0;n<buttonsOnSpreadLength;n++)

    {

        tempSpread.buttons.itemByName(buttonNames).move(targetSpread);

    };

    panelStates.visible = false;

    tempSpread.remove();

   

    doc.select(selectedButton);

    panelStates.visible = true;

};

Regards,
Uwe

// Removed a typo in the function name of the script.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Feb 28, 2017 Feb 28, 2017

Copy link to clipboard

Copied

I have realized that the nature of this project will require manual labor. 😞

As you fine geniuses have suggested, I did plan ahead and named the "original" set of buttons and created them alphabetically.  However, as the project grew wings, changes and additions have made the original plan useless, since the visibility list of objects is sorted by when an item was added.

Laubender, my hope was to be able to possibly sort alphabetically, then sort back to creation order, but because of the complex nature, by the time I would address all of these ideas, I can be done doing it manually.

My challenge is that my list of 80+ text lines - each one being a button - are each used for show/hide functionality for multiple other objects at times. I needed to change from an On Roll Over and On Roll Off basis to using On Click instead. Unfortunately, changing that functionality is basically starting over when it comes to finding and marking the show/hide object's visibility status.

I am going to submit a wish list item that would allow you to simply change the Event (On Click, On Roll Over, etc.) instead of deleting each event then creating a new one from scratch, at least in a case like this.

For me, INDD was the best tool to use, but it has understandable limitations.

I do appreciate the effort you all took.  Thank you!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 28, 2017 Feb 28, 2017

Copy link to clipboard

Copied

joet082964  wrote

I have realized that the nature of this project will require manual labor. 😞

Laubender, my hope was to be able to possibly sort alphabetically, then sort back to creation order, but because of the complex nature, by the time I would address all of these ideas, I can be done doing it manually.

Hi Joe,

from "alphabetically" back to "creation" order is no problem at all.

With InDesign every page item has an ID number, the higher the number, the younger the page item.

So we can sort by numbers. Same concept:

Move all buttons out of the spread.

Move them in one by one in sorted order. This time sorted by ID.

Here the code in ExtendScript (JavaScript):

// moveButtonsToCreationOrder_ONE-BUTTON-SELECTED.jsx

// Uwe Laubender

/*

  

    Published at Adobe InDesign Forum:

  

    Interactive button list

    joet082964 Feb 27, 2017 9:06 PM

    https://forums.adobe.com/thread/2283453

  

    // Tested with: CS5.5 , CS6 , CC, CC 2014.2, CC 2017

  

*/

/**

* @@@BUILDINFO@@@ moveButtonsToCreationOrder_ONE-BUTTON-SELECTED.jsx !Version! Tue Feb 28 2017 17:28:55 GMT+0100

*/

app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;

app.doScript

    (

  

    moveButtonsToAlphabeticalStackingOrder,

    ScriptLanguage.JAVASCRIPT,

    [],

    UndoModes.ENTIRE_SCRIPT,

    "Move buttons of spread to CREATION stacking order | SCRIPT"

  

    );

function moveButtonsToAlphabeticalStackingOrder(){

    if(app.documents.length == 0){return};

    if(app.selection.length != 1){return};

    if(app.selection[0].constructor.name != "Button"){return};

    if(app.selection[0].parent.constructor.name != "Spread"){return};

  

    var doc = app.documents[0];

    var selectedButton = doc.pageItems.itemByID(app.selection[0].id);

    doc.layers.everyItem().locked = false;

  

    var panelStates = app.panels.itemByName("$ID/$$$/Panel/States");

  

    var targetSpread = app.selection[0].parent;

    var tempSpread = doc.spreads.add( LocationOptions.AFTER , targetSpread );

  

    var buttonsOnSpread = targetSpread.buttons.everyItem().getElements();

    var buttonsOnSpreadLength = buttonsOnSpread.length;

    var buttonIDs = [];

    for(var n=0;n<buttonsOnSpreadLength;n++)

    {

        buttonIDs[buttonIDs.length++] = buttonsOnSpread.id;

    };

    buttonIDs.sort(function(a,b){return a-b});

    targetSpread.buttons.itemByRange(0,-1).locked = false;

    targetSpread.buttons.itemByRange(0,-1).move(tempSpread);

    for(var n=0;n<buttonsOnSpreadLength;n++)

    {

        tempSpread.buttons.itemByID(buttonIDs).move(targetSpread);

    };

    panelStates.visible = false;

    tempSpread.remove();

  

    doc.select(selectedButton);

    panelStates.visible = true;

};

Regards,
Uwe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Feb 28, 2017 Feb 28, 2017

Copy link to clipboard

Copied

Uwe,

Would this move them back into their respective XY coordinates?

Also, I thought that adding elements to the page, and then turning them into a button would automatically put them at the end of the "Visibility" list, but  that does not seem to be the case.  For instance, I created a shape, turned it into a button and named it, and it appeared in what seems to be a random spot in my list.  Other elements I added (converted to buttons) came right after it, but not the first shape I added. Any idea on the default sorting order?  I don't think it is the most recent at the bottom.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 28, 2017 Feb 28, 2017

Copy link to clipboard

Copied

joet082964  wrote

Uwe,

Would this move them back into their respective XY coordinates?

Yes.

But I do not test the coordinates before and after.

Just run the script and give it a try. You can undo the script's action in one go.

Hm. About the order objects are listed in "visibility":
As we found, it is the order they "appear" on the spread.
Otherwise moving them to a spread to re-order them would not work.

What exactly "appear" means we have to find out.

For now I tested "moving from a different thread".

And as I tested my second script that is doing the ordering after ID number I can see that the old order is in creation order of the object in the document. That imposes the question, if the ID number will change if you convert a rectangle to a button. I don't think so. And this is giving a hint to the "arbitrary" order you see in "visibility".

Regards,
Uwe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 28, 2017 Feb 28, 2017

Copy link to clipboard

Copied

We could proof my theory about the initial order of objects.

I ran a script that is renaming the buttons on the spread to their ID numbers.

After running the script the order of names should show numbers in ascending order from top to down.

Before:

1-renameButtonsOnSpreadToIdNames-BEFORE-SCRIPT-ACTION.png

After renaming by ID number:

2-renameButtonsOnSpreadToIdNames-AFTER-SCRIPT-ACTION.png

And indeed:

The names showing in "Visibility" is a regular list of ascending numbers from top to down.

Your "arbitrary" order could stem from the fact, that an object—maybe a rectangle—you turned to a button was created in chronological order in between other objects you were transforming to buttons. It's not the moment that counts when you transform a graphic object to a button, but the moment when the graphic object sees the spread.

Regards,
Uwe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 28, 2017 Feb 28, 2017

Copy link to clipboard

Copied

Important note:
That the order of renamed buttons in the panel is in the order of IDs also means that I never "moved" a button to the spread before. And with "moved" I mean in fact dragging a button or a object that I later transformed to a button accross the boundaries from a different spread to the active spread where the button is selected. And the selection is showing the order in the panel.

Regards,
Uwe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Feb 28, 2017 Feb 28, 2017

Copy link to clipboard

Copied

Everything you note makes sense...and that there is a convoluted system to it all.

In addition, I have found that using OBJECT>INTERACTIVE>SET TAB ORDER...  is a perfect way to reorder. However, it is very slow and unmanagable with a list of objects as large as mine. If only it had a few small options like resizing the window and maybe some simple sorting capabilities.  If only...

Thanks again!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 28, 2017 Feb 28, 2017

Copy link to clipboard

Copied

Thank you for mentioning

"Set Tab Order".

Indeed that is working:

Dragging the objects around is possible.

Also working the Up and Down controls.

But you mentioned it:

The panel is not resizable.

Arrgh…

Using "Set Tab Order" and closing it with OK will not instantly update the "Buttons and Formfields" panel if a button is selected. Only after closing/reopening the panel or deselecting/reselecting the button will update the panel.

Regards,
Uwe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 01, 2017 Mar 01, 2017

Copy link to clipboard

Copied

Hi Joe,

currently I am rethinking your tedious task of ordering items with the "Set Tab Order" window.

Note: "Set Tab Order" will only show items on the page.

Not items on another page of the same spread.

Or items on the pasteboard.

On the dark side we have:

1. The window is not expandable to show more items than 10 at one time.

2. There is no way to order elements by name automatically just like the Paragraphs Styles panel is able to do.

3. It is not a "panel", it is a window. Means, that you have to close it to see the results.

On the bright side we have:

1. You can drag items to new positions.

2. You can drag more items than one to new positions.

3. You can change position of selected items in the stack by using Up and Down buttons.

What would be needed is:

1. Expandability of the window, verically and horizontally:

If the numbers of elements is very large, the items should be shown in columns.


2. Sorting items by Name

3. Sorting by stacking order as seen in the Layers panel

4. Saving a particular stacking order to an Order Set

5.1 It should be a "palette" type of window, means that you are able to work with items on the page while "Set Tab Order" is open.

6.2 Automatic refreshing if you drag an item out to the pasteboard or to another page.

7. Expanding the Info Area of the document so that items on the pasteboard would show up in the window.

8. Removing and adding items to the Tab List.

All in all: A lot more flexibility.

How about the following scripting concept:

1. Script: Write all item names and IDs of the Tab Order List to an InDesign table.

2. Script: Read the table row contents to establish a new Tab Order on the page.

3. Script: Order the table rows alphabetically, by stacking as shown in the layers panel, etc.pp.

4. Or do the ordering by "hand" moving around table rows.

5. Script: Expand the Info Area to an object selected on the pasteboard.

Or by input of numbers. Without going to the document Setup window.

By using this table approach you could do backups of sorting orders by simply duplicating the InDesign table.

You could establish a color scheme or a formatting scheme of items by simply formatting the table rows and the text. Even some housekeeping is possible by adding a new column to the table for doing comments.

What do you think?

Regards,
Uwe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 01, 2017 Mar 01, 2017

Copy link to clipboard

Copied

Hi Joe,

I took a different approach, rather than try to manipulate the buttons palette, I wrote my own.

ButtonNavigator - Kerntiff Publishing Systems

P.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 01, 2017 Mar 01, 2017

Copy link to clipboard

Copied

And another thing what could be done by scripting:

We could remove ( and also add ) items from the "Tab Order List" without moving the items out on the pasteboard, to a different page or to a different spread.

A quick test is showing that a script is able to remove all not selected buttons from the list. It would also be able to memorize the old list. And another script would reapply all the ones again from the memorized list.

That means:
You could just select the buttons you want to see and change with the "Buttons and Formfields" panel, run the script, edit visibility, run another script to get back to the old order with the "Tab Order List" or select some other buttons to work on or run the script again on the other ones selected.

The buttons need not to leave the page.

Just a quick test for removing items from the "Tab Order List":

1-RemoveAllItemsFromTabOrderList-ButSelectedOnes.png

After running the script all buttons stay put on the page.

The ones selected stay in the list:

2-RemoveAllItemsFromTabOrderList-ButSelectedOnes.png

3-RemoveAllItemsFromTabOrderList-ButSelectedOnes.png

Regards,
Uwe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 06, 2017 Mar 06, 2017

Copy link to clipboard

Copied

LATEST

Thank you Laubender  I sent you a private message with a link to the project.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines