Reply to topic  [ 5 posts ] 
Macro to number bullets 
Author Message

Joined: 2007-12-05 12:29:24
Posts: 4
I've finally taken the plunge to NWPro. I've got so much invested in my NW6.03 macros ... but time to covert I guess since my new Macs won't run Sys9.

[I sure miss the old 'record macro' option. Also the "macroize" button in the Find/Replace window. That was useful. I'll have to figure out the browser.]

I write really complex search/replace strings on the fly in the S/R window. Old version let me 'undo' from edit menu. Is there no 'undo' when (mis)typing in the new S/R window?

Here's why I posted today. I need a advice for converting/rebuilding my macro library; could someone point me in right direction. Also, right now I could use an elegant way to renumber bullets in a doc. My old macro snippet:

Code:
If (SelectStart == SelectEnd) SetSelect(SelectStart,EndCharNum)
Find/Replace "•" "" "Wagt-g-o-O"


Thank you helpful Nisus folk.


2007-12-05 13:20:22
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
Jack Lint wrote:
Old version let me 'undo' from edit menu. Is there no 'undo' when (mis)typing in the new S/R window?

Nisus Writer Pro lets you undo/redo in the Find & Replace window just as you can in a normal document, eg: the menu Edit > Undo or Command + Z.

Quote:
I need a advice for converting/rebuilding my macro library; could someone point me in right direction.

In general there's no resource that would help you convert your old macros as the NWP macro language is significantly different from that found in Classic. For help with the new macro language I would recommend the help built into NWP and the "Nisus Macro Reference" file found on the NWP disk image.

If you have specific questions, go ahead and ask them here. Also, I know the Nisus dartmouth list has a variety of knowledgeable users that made extensive use of macros in Classic Nisus Writer.

Quote:
right now I could use an elegant way to renumber bullets in a doc. My old macro snippet:

Code:
If (SelectStart == SelectEnd) SetSelect(SelectStart,EndCharNum)
Find/Replace "•" "" "Wagt-g-o-O"

I'm not sure I see what this replacement is supposed to do. To me it looks like it just deletes all list bullets. If you explained its intention I might be able to help you form an equivalent macro for NWP.


2007-12-05 15:36:55
Profile WWW

Joined: 2007-12-05 12:29:24
Posts: 4
Post 
Here's the macro in its entirety. I use it all the time (in v6). It allows me to embed any symbol (here a bullet) repeatedly anywhere in my document and upon running the macro all are exchanged for sequence of 'soft' numbers - which I later convert to 'hard' (via 'convert variables to text') .

Code:
//==================== MACRO Renumber
//   This macro replaces bullets with the automatic numbering tags (using the “Custom A” counter). If there is no selection, it does this from the insertion point to the end of the document. After the numbering is done, you can customize the starting number and the format of the numbers by using the “Define Numbers” menu command on the Insert menu.
If (SelectStart == SelectEnd) SetSelect(SelectStart,EndCharNum)
Find/Replace "•" "1" "Wagt-g-o-O"



Here's another macro that does the same thing but writes 'em out hard straight away.

Code:
Select All
Find All "•" "gos"
s -> push (startends)
if (s -> error) goto reportError

number = s ->size/2
loop:
if (!s -> size) exit
SetSelect(s->pop, s-> pop)
clipboard = 0 + number
MacroPaste
number = number - 1
goto loop


//   probably low on memory.
reportError:
:1 "Error: unable to save all • positions."


Thanks for the help Martin.


2007-12-05 18:41:48
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
Post 
To write a macro that replaces all of a certain bit of text (like your bullet) with literal characters codes, see this thread.

If you want to replace your bullets with automatic variables, that may not be possible in the general sense. Currently NWP doesn't have general purpose variables. However, if your bullets always appear at the start of a paragraph, then you can construct a macro that applies a custom list style which would do the automatic counting.

Let me know if you have any questions on this process.


2007-12-06 00:49:42
Profile WWW

Joined: 2007-12-05 12:29:24
Posts: 4
Post 
Thanks. That'll work.


2007-12-08 18:07:53
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: Bing [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software