Copy link to clipboard
Copied
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
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 (dial
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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;
}
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi Frans,
Thanks for the link - I'm emailing them now with my fingers crossed.
Thanks again
Copy link to clipboard
Copied
Thanks Jongware...I've got to be honest, i don't what to do with that script to get it to run in InDesign. I've tried adding it to the script panel but when i go to run it, it comes up with errors...it's probably something very basic as i'm not an expert on that side of things.
Thanks for trying though it is HUGELY appreciated (and unexpected, so THANKS)
Copy link to clipboard
Copied
I tested it in CC2017.1 and it worked with a small amount of buttons. So, what errors do you get?
Copy link to clipboard
Copied
Hi Jongware,
This - but like i say, that could be down to me not doing something correctly.
Thanks
Copy link to clipboard
Copied
Ah, you must be on a Mac – and you probably used TextEdit
TextEdit defaults to saving files as formatted text (the "RTF" in you error message). A script should be saved as plain text. Look in the TextEdit menu (it should be called something exactly like that), or use a code editor such as TextWrangler, BBEdit, Sublime Text, vim, or Adobe's own ExtendScript Toolkit Editor (the latter ought to be installed along with InDesign itself).
Copy link to clipboard
Copied
oh my god! that's solved it and it works like a DREAM!
Amazing!!!! thank you SO much Jongware. A M A Z I N G!!!!!