In inDesign, is there a way to highlight a piece of text that has been clicked to from another page? For example, a button from page 2, when clicked, would go to a table with rows. Can I highlight a row, or text like this through code?
do you like a selection of text like you do it without a script or do you like to address the text to apply a certain formatting or whatever? Both can be done by scripting. The difference: In a table you can do only one single selection of text in a cell at one time.
By addressing the cell and its text without selecting it you could run either a loop that visits every table in your table document or, if this is your goal, you could address every third cell in the first column of every table in your document in one go. See code below.
On ‘everyItem()’ – Part 2 Marc Autret, July 19, 2010
"Note. — Contrary to popular belief, it is not necessary that each document hosts 3 groups to set app.documents.everyItem().groups as a container. It suffices that at least one document satisfies this requirement."
That means, in your case it needs at least one table in your document with a third text cell in the first column to address this one ( and all other ones if there are any ) and theit texts with:
Change formatting of fill color of every text in
the third cell of the first column
of every table in the document
// Just an example:
fillColor : app.documents.colors.itemByName("Black")
// Add other property / value pairs if you like below
You build your own UI with e.g. ScriptUI to select all instances one after another.
But this requires more effort than a couple of code lines.
Thank you for replying; I don't even know where to start with scripting. With my Flash experience and action script I would have applied an onClick() to a button, or text link and then when it jumped to a page, I could pass a command to highlight the text in the table. Not that simple it seems in inDesign. It's probably not done that much, but seems like an intuitive piece of code; especially with text dense documents. I'll keep trying. Any other clues on where to apply the code would be great. thank you.
Flash with ActionScript is a totally different thing compared with ExtendScript and InDesign.
Something like highlighting (selecting) all text in a table is simply not possible in InDesign.
Not with the GUI, not by scripting.
What you can do is select all cells in a table. Or all cells of a certain table row. In the GUI and by scripting.
Identify a certain table first. That's perhaps the hardest part to do. You need to start somewhere. Just an example below. If you have the text frame of a table selected in the GUI where there is only one table in the story of this text frame this goes like that:
var myTable = app.selection.parentStory.tables;
If you now want to select the second row for example, use variable myTable like that: