Page 1 of 1

Finding the next table

Posted: 2009-08-19 11:44:20
by js
How does one find the next table in a long text?

Re: Finding the next table

Posted: 2009-08-19 12:29:41
by martin
There's a very short macro that can do this:

Code: Select all

Select Next Table
If you want to get a little fancier, with an option to wrap the search back to the document start:

Code: Select all

$foundTable = Select Next Table
If ! $foundTable
	# prompt always includes a button to cancel the macro
	Prompt "No more tables found. Would you like to search from the start of the document?", '', 'Search From Start'
	Select Document Start
	Select Next Table
End

Re: Finding the next table

Posted: 2009-08-19 14:40:29
by js
Thank you.
Your macro lets me turn round. But I found that strangely you can jump only downwards from table to table, but not upwards, which was maybe why you wrote it.
Following your model I wrote this which allows to go upward. Arriving on table one repeating it keeps the selection to let you know.

Code: Select all

$foundTable = Select previous table
If $foundTable
Send Selector 'moveUp:'# to get out of the table in case you are trapped in a selection
End

Select previous table
Scroll to Selection

Re: Finding the next table

Posted: 2009-08-19 16:04:43
by martin
I'm glad you found my macro useful. I'm not sure I understand yours. Just the simple:

Code: Select all

Select Previous Table
..works for me. Your macro jumps up by two tables at a time.

Re: Finding the next table

Posted: 2009-08-20 01:50:41
by js
I can't explain it. I tried to copy some of my tables from the document in question into a new document, putting some text between. Now it works as you say (and my macro leaves one out). Mystery.
Same thing with a macro consisting of nothing than the line "select previous table".