Skip to main content
philbanks76
Participating Frequently
August 1, 2017
Answered

Searching button names

  • August 1, 2017
  • 1 reply
  • 1042 views

Hi,

This should be simple but i can't find the answer. Is there a way to search button names in InDesign?

I've been given a document that has 100s of (if not over 1000) buttons on many different pages and am trying to fix a bug. The only thing is, the buttons haven't been named so i don't know where to find them - is there a way to search them?

Thanks,

Phil

    This topic has been closed for replies.
    Correct answer Jongware

    Something like this maybe? It's an ugly old style dialog, but that's only because it has been whipped up in 5 minutes.

    It needs to collect all button names at the start so I hope it doesn't lag too much with your number of buttons.

    The alternative would be a simple prompt that asks for a name, but then you'd need to know the name of the button in advance.

    allbuttons = app.activeDocument.buttons.everyItem().name;
    var d = app.dialogs.add({name:"Pick a button"});
    with (d.dialogColumns.add())
    {
    with (dialogRows.add())
      var dd = dropdowns.add({stringList:allbuttons});
    }
    dd.selectedIndex = 0;

    if(d.show())
    {
    var index = dd.selectedIndex;
    app.activeDocument.buttons.itemByName(allbuttons[index]).select();
    app.activeWindow.zoomPercentage = app.activeWindow.zoomPercentage;
    }

    1 reply

    Jongware
    Braniac
    August 1, 2017

    It's probably possible through scripting, but it makes me wonder what you are hoping for. If the buttons have no name, what are you going to search for?

    philbanks76
    Participating Frequently
    August 1, 2017

    Hi Jongware,

    Thanks for the reply. They're actually named (M20, M40, MC127 etc) just not in a way I know where they're located in the document (it's over 60 pages with sometimes over 100 buttons on one page, so a bit of pain to search through each time. If it's a script thing, don't worry, I'll persevere and let people know to name their buttons in a more useful way

    Just wasn't sure if i was missing something obvious...like in the Find/Change tool.

    Thanks again

    Jongware
    JongwareCorrect answer
    Braniac
    August 1, 2017

    Something like this maybe? It's an ugly old style dialog, but that's only because it has been whipped up in 5 minutes.

    It needs to collect all button names at the start so I hope it doesn't lag too much with your number of buttons.

    The alternative would be a simple prompt that asks for a name, but then you'd need to know the name of the button in advance.

    allbuttons = app.activeDocument.buttons.everyItem().name;
    var d = app.dialogs.add({name:"Pick a button"});
    with (d.dialogColumns.add())
    {
    with (dialogRows.add())
      var dd = dropdowns.add({stringList:allbuttons});
    }
    dd.selectedIndex = 0;

    if(d.show())
    {
    var index = dd.selectedIndex;
    app.activeDocument.buttons.itemByName(allbuttons[index]).select();
    app.activeWindow.zoomPercentage = app.activeWindow.zoomPercentage;
    }