nisus.com
https://www.nisus.com/forum/

selection before first cell of table
https://www.nisus.com/forum/viewtopic.php?f=17&t=4023
Page 1 of 1

Author:  js [ 2010-12-16 05:15:46 ]
Post subject:  selection before first cell of table

If the cursor is in a table, how can a macro set it at the start of the table (it is: before any text in the first cell of the first row).
Select start seems to work only if there is no text before the table.

Author:  martin [ 2010-12-16 09:03:22 ]
Post subject:  Re: selection before first cell of table

This ought to do the trick:
Code:
If TableSelection.active
   Select Table Cell 1,1
   Select Start
End

Author:  js [ 2010-12-16 11:27:14 ]
Post subject:  Re: selection before first cell of table

Thank you Martin.
Unfortunately I still don't know how to make my macro work. It starts with the lines

Code:
Columns
Copy
select table


Assuming the the cursor is anywhere within Column X I should now have a copy of the column on the clipboard and the table should be selected.
If the Table is topmost on my document this works. If there is any text before is doesn't. I don't understand this.
What should be my next line if I want the cursor to be at the beginning of Cell 1,1?

Author:  martin [ 2010-12-16 12:58:44 ]
Post subject:  Re: selection before first cell of table

Your macro works for me, regardless of where the table is in the document, and how many tables are in the document. What do you mean by it doesn't work? Do you mean the column is copied, but the table is not fully selected? If not, what exactly is selected after the macro runs?

Perhaps there's something more peculiar about your document- maybe posting it would help.

Author:  js [ 2010-12-16 14:33:34 ]
Post subject:  Re: selection before first cell of table

OK Is send the complete macro (which served to do simple column sorts in a Nisus table:

HERE IS MY FILE:
# file start
With this line the macro complains about an error; without it it works
1 pear first
2 apple second
3 orange third
# file end

HERE IS MY MACRO:
# My Sort Macro:
Columns
Copy
select table
Select Start
Paste
select table
Ascending (A-Z)
Select Start
Columns
Delete
# end of Sort Macro

Author:  martin [ 2010-12-16 16:41:31 ]
Post subject:  Re: selection before first cell of table

It works for me. If I select something in the 2nd column before the macro runs, eg:
Attachment:
Picture 1.png
Picture 1.png [ 12.11 KiB | Viewed 4621 times ]

And run your macro, the table has been sorted by the 2nd column, eg:
Attachment:
Picture 2.png
Picture 2.png [ 12.2 KiB | Viewed 4621 times ]

Is that not what you're seeing? If you simply want the insertion point to be in the first table cell after the macro runs, add the line:
Code:
Select Start

To the very end of the macro.

Author:  js [ 2010-12-17 02:11:46 ]
Post subject:  Re: selection before first cell of table

I dont' know how to put a screen photo on this list. I send it to you by mail attachment. Maybe you could put it on the list for me.
On the photo you can see how my macro complains as soon as the table is not on top. Without that it works fine for sorting small tables within Nisus.

Author:  js [ 2010-12-17 02:23:28 ]
Post subject:  Re: selection before first cell of table

Martin, I guess I should have added this:

My whole purpose to want the cursor at the beginning of cell 1 is for inserting a copy of the column I want to be sorted, the one where I put the cursor at the outset.
Afterwards haveing copied that column, the whole table has to be selected, to apply the sort order to the whole table, not only to the first column.
After that, the copied column can be deleted. Of course the macro would look a bit nicer if the insertion point could go back to where it was at the beginning.

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/