Search found 1300 matches

by phspaelti
2022-12-15 16:20:55
Forum: Nisus Writer Pro Macros
Topic: Extend Line to Right Line Indent
Replies: 14
Views: 3814

Re: Extend Line to Right Line Indent

This is still not great, but it might be a bit better: $doc = Document.active $loc = $doc.textSelection.location $range = $doc.text.rangeOfLineAtIndex $loc $loc = $range.location $sel = TextSelection.new $doc.text, $range $doc.setSelection $sel $newRange = $range $kern = 0.0 while $newRange == $rang...
by phspaelti
2022-12-15 15:51:07
Forum: Nisus Writer Pro Macros
Topic: Extend Line to Right Line Indent
Replies: 14
Views: 3814

Re: Extend Line to Right Line Indent

I think it's difficult for the Macro Language to process text linewise, so it may be necessary for the user to select the entire line in question before invoking the Macro, rather than the Macro start by finding all text in the line containing the cursor. But that's OK. Selecting the (layout) line ...
by phspaelti
2022-12-08 19:56:48
Forum: Nisus Writer Pro Macros
Topic: multi-file search
Replies: 11
Views: 5362

Re: multi-file search

Hopefully you don't mind a bit of tinkering... I'm attaching an amended macro that has a few user-experience enhancements: Thanks! Actually I had been thinking about adding a status bar myself. Thanks for that. One thing I really don't like though is that this macro swamps the "Recent Items&qu...
by phspaelti
2022-12-08 19:54:58
Forum: Nisus Writer Pro Macros
Topic: Keyboard shortcuts not visible on Macro Menu
Replies: 7
Views: 2314

Re: Keyboard shortcuts not visible on Macro Menu

Hi WF,
I see that intermittently. I think usually when I restart Nisus the macro shortcuts don't show, but after I run one, they start to appear. So maybe this is not the same thing :?
by phspaelti
2022-12-01 05:54:27
Forum: Nisus Writer Pro Macros
Topic: multi-file search
Replies: 11
Views: 5362

Re: multi-file search

Here is another solution to this problem to take advantage of the search feature in the Document Manager described by Þorvarður. The macro creates a user group and adds all the files in the folder as well as all files in all subfolders. That way they will be collected in one group and can be searche...
by phspaelti
2022-12-01 00:15:45
Forum: Nisus Writer Pro Macros
Topic: multi-file search
Replies: 11
Views: 5362

Re: multi-file search

Side-stepping the philosophical discussions, here is my attempt at a macro for solving this problem. It will search through all sub-folders for relevant files and check them against the find dialog. It will then let you how many it found, and ask whether you want to open them and show the results. Y...
by phspaelti
2022-11-16 22:25:46
Forum: Nisus Writer Pro Macros
Topic: Help with Macro sentence spacing
Replies: 8
Views: 2577

Re: Help with Macro sentence spacing

Indeed. In all likelihood it was a "clean up" macro that tried to enforce one and only one space after periods, perhaps excluding periods followed by quotation marks. Which brings up the question how one might write such a macro that avoided doing that. My first reaction to this problem wa...
by phspaelti
2022-11-05 05:18:40
Forum: Nisus Writer Pro Macros
Topic: Table: How to find coordinates of selected cells
Replies: 4
Views: 2144

Re: Table: How to find coordinates of selected cells

Hello js, I see what you are saying. Nisus does have the Selection object which can work with non-continguous selections, but this object does not have direct access to the cells in the selection. You will have to loop through all the TableSelections within the selection. If your TableSelection(s) d...
by phspaelti
2022-11-05 05:07:47
Forum: Nisus Writer Pro Macros
Topic: Loop through open documents
Replies: 3
Views: 1833

Re: Loop through open documents

As Adrian says Document.openDocuments should work. The following code will apply My Fantastic Macro to all open documents.

Code: Select all

foreach $doc in Document.openDocuments
Document.setActive $doc
My Fantastic Macro
end
by phspaelti
2022-11-03 05:20:18
Forum: Nisus Writer Pro Macros
Topic: Table: How to find coordinates of selected cells
Replies: 4
Views: 2144

Re: Table: How to find coordinates of selected cells

First of all, remember that this is Nisus, so if you want to find something you can always use Find/Powerfind. But otherwise it will depend on what you want to achieve If you have a TableCell object you can use the .row and .column properties If you have a Table object you can get the number of rows...
by phspaelti
2022-10-30 04:27:47
Forum: Nisus Writer Pro Macros
Topic: Editing table cell borders
Replies: 3
Views: 1793

Re: Editing table cell borders

Also: can I change the whole table at one go, or do I have to write a couple of loops to address every cell and change its borders individually? Yes, you can change the whole table in one go. For that you should work with table selections. For example: $doc = Document.active Select Table 1 $tblSel ...
by phspaelti
2022-10-30 04:18:10
Forum: Nisus Writer Pro Macros
Topic: Editing table cell borders
Replies: 3
Views: 1793

Re: Editing table cell borders

As the message says you need a line attribute object not text: Select Table 1 $thisTable = Table.selectedTable $aCell = $thisTable.cellAtRowAndColumn 1, 1 $lineAttr = LineAttributes.newWithLineType 'invisible' $aCell.setLineAttributesForEdges $lineAttr, 'top' You can, if you prefer combine it like t...
by phspaelti
2022-10-05 20:22:53
Forum: Nisus Writer Pro
Topic: Automatic Figure Titles
Replies: 5
Views: 1583

Re: Automatic Figure Titles

That's what Cross-references are for. NWP allows you to cross-reference items like list items or bookmarks. So you will need to choose one. For example using Bookmarks Bookmark the relevant bit of text Go to the place you want to insert and choose "Insert Cross-reference" Choose the proper...
by phspaelti
2022-10-02 19:36:44
Forum: Nisus Writer Pro Macros
Topic: Select a list as a group.
Replies: 9
Views: 3062

Re: Select a list as a group.

And now to this. I was actually looking to select each list number or bullet and put a leading and trailing CR. Here you are saying select each list number or bullet . But what your example is doing is selecting the whole list as a unit. And I suspect that that is why Martin was asking what you are ...
by phspaelti
2022-10-02 18:57:11
Forum: Nisus Writer Pro Macros
Topic: Select a list as a group.
Replies: 9
Views: 3062

Re: Select a list as a group.

Hello Lou, Did that bit of macro code ever work in the past? First about '\0'. '\0' refers to the found text. So it couldn't have any meaning in a "Find (All)" expression. That would amount to saying 'find what you find' :lol: It also doesn't work in Replace All because Replace All doesn't...