Search found 1002 matches

by phspaelti
2019-09-09 16:03:38
Forum: Nisus Writer Pro Macros
Topic: Find/replace in each paragraph of the selection
Replies: 10
Views: 275

Re: Find/replace in each paragraph of the selection

1. Find in Selection - Method 1. I'm afraid I don't understand your hint. Could you please give a worked out example? Find '^.+?\t\d+', 'Eas' $results = $doc.textSelections … … I just needed to modify a bit the syntax since the Selection object doesn't have a .range property: Sorry about that. Actu...
by phspaelti
2019-09-09 04:47:09
Forum: Nisus Writer Pro Macros
Topic: Find/replace in each paragraph of the selection
Replies: 10
Views: 275

Re: Find/replace in each paragraph of the selection

Ah, yes, these are good questions. 1. Find in Selection The macro command .find can unfortunately not be limited to a selection, the way the menu command can. There are a couple of ways to work around this. Method 1: You can do the initial find using the menu command "Find in Selection" and then use...
by phspaelti
2019-09-08 17:13:40
Forum: Nisus Writer Pro Macros
Topic: Find/replace in each paragraph of the selection
Replies: 10
Views: 275

Re: Find/replace in each paragraph of the selection

Now for the second point: … the macro should check user input against the number at the end of each line). In the previous code, the "found bit" is in the $result.subtext . Since you will want the number to check against, how to do that? The trick is another clever feature of the macro language find...
by phspaelti
2019-09-08 16:39:30
Forum: Nisus Writer Pro Macros
Topic: Find/replace in each paragraph of the selection
Replies: 10
Views: 275

Re: Find/replace in each paragraph of the selection

Okay then. First, if you want to allow for variable pre/post you can do this like this: $pre = '<pre>' $post = '<post>' Find And Replace '^.+?\t\d+', $pre &'\0' & $post, 'Ea' Now let's consider how we can do find/replace in the macro language. Find and Replace is an operation on text, so you need a ...
by phspaelti
2019-09-08 14:44:23
Forum: Nisus Writer Pro Macros
Topic: Find/replace in each paragraph of the selection
Replies: 10
Views: 275

Re: Find/replace in each paragraph of the selection

Hello JohSeb, Let me first ask, is there a particular reason why you are trying to do this with a macro? You can accomplish exactly this with Find/Replace directly, and you can also just macroize the Find/Replace expression. That should look something like this: Find And Replace '^.+?\t\d+',"Pre \\0...
by phspaelti
2019-09-01 22:48:34
Forum: Nisus Writer Pro
Topic: Table Format for Sort by date?
Replies: 31
Views: 2111

Re: Table Format for Sort by date?

Hello again feathers, Nice job with all that testing! Here is an updated version with the ascending/descending feature added: Sort Table Rows By Selected Date Column.nwm As to the other points: I'm not sure what's going on with blank cells for you. For me blank cells sort at the end, or at the begin...
by phspaelti
2019-08-31 17:16:50
Forum: Nisus Writer Pro
Topic: Table Format for Sort by date?
Replies: 31
Views: 2111

Re: Table Format for Sort by date?

…but just report now that the one that's interesting me most at the moment is the one that sorts the table in one go, which will be trickiest I expect. (ie. "Sort Table Rows By Selected Date Column".) On my first tests it threw an error, and I'll just ask if it's capable of handling a table with a ...
by phspaelti
2019-08-30 21:41:03
Forum: Nisus Writer Pro
Topic: Table Format for Sort by date?
Replies: 31
Views: 2111

Re: Table Format for Sort by date?

Now that the issue of ordinal dates has been raised, it's not enough to strip out the ordinal suffixes when converting to ISO format. You probably want to (re)instate them when doing the inverse operation. Except of course that once you have converted them you won't know if the original dates had o...
by phspaelti
2019-08-30 19:06:46
Forum: Nisus Writer Pro
Topic: Table Format for Sort by date?
Replies: 31
Views: 2111

Re: Table Format for Sort by date?

So, what are the "other drawbacks" that you speak of for this one? Since Adrian's macro uses Find/Replace it affects only the date parts of your selection, and leaves the rest intact. The macro I provided will, if given a selection that contains non-date parts, might end up deleting/overwriting tho...
by phspaelti
2019-08-30 18:05:34
Forum: Nisus Writer Pro
Topic: Table Format for Sort by date?
Replies: 31
Views: 2111

Re: Table Format for Sort by date?

Adrian's macro is nice, but will not work properly, if the date has the form "January 2nd, 2019". Here's a different macro which may succeed in more cases, but has other drawbacks.
by phspaelti
2019-08-17 03:24:24
Forum: Nisus Writer Pro Macros
Topic: Macro to assign style
Replies: 6
Views: 1653

Re: Macro to assign style

Re 2: the command you need would be

Code: Select all

$paras.appendItemsFromArray $charas
99% I’m typing this from my phone
by phspaelti
2019-08-13 18:09:46
Forum: Nisus Writer Pro
Topic: Space around lists, quotations, etc.
Replies: 23
Views: 3620

Re: Space around lists, quotations, etc.

Hello Adrian, While I understand what you are trying to do here, I really think that once you get into the thick of using macros to accomplish such complex tasks, you should get over your aversion to using the macro language. Basic Find and Replace is fine for simple editing macros, and making selec...
by phspaelti
2019-07-24 06:22:41
Forum: Nisus Writer Pro Macros
Topic: Normal to Body Text
Replies: 6
Views: 1762

Re: Normal to Body Text

Here is how I would use the macro language to solve this problem: # Select First Paragraph of Each Selection Block $doc = Document.active $sels = $doc.text.find $doc.styleWithName('Normal'), 'a' $firstParas = Array.new foreach $sel in $sels $firstParas.push TextSelection.new $sel.text, $sel.text.ran...
by phspaelti
2019-07-21 20:06:59
Forum: Nisus Writer Pro Macros
Topic: Normal to Body Text
Replies: 6
Views: 1762

Re: Normal to Body Text

Hello Todd, Assuming you want hints about how to solve this rather than a fully written out solution, let me suggest this. Start by giving all Body Text the same style. If you select these, then you will have an array of selections. The index/location of each selection block is the index of the firs...
by phspaelti
2019-07-09 16:01:35
Forum: Nisus Writer Pro
Topic: Automatic numbers lost in sort Table
Replies: 11
Views: 2719

Re: Automatic numbers lost in sort Table

I don't really need the word 'Scene' at the start, would tha help? Exactly. "Numbers" of the form "Scene 1" are sorted alphabetically. So "Scene 101" will precede "Scene 25" which will precede "Scene 9". They would need to be 0-padded to sort correctly. But if you remove the "Scene " then they will...