Reply to topic  [ 4 posts ] 
Save for Word Macro 
Author Message
User avatar

Joined: 2004-10-26 07:10:40
Posts: 174
Location: Tucson, AZ
Hello all,

As I'm no programmer, I need help writing a macro. Some of my styles do not translate well when opening an rtf in Word, so I would like to create a Save for Word macro that does the following...

    Finds all of one style and replaces with another (if no style instance found, ignore and move to next command)

    Finds all of another style and replaces with another (once again, if no style instance found, ignore and move to next command)

    Turns off Allow Hyphenation

    Saves a document as original filename without extension with (for Word) appended

For example:

    Find All Paragraph Style H1 Sans Bold xS and Change All to Word - H1 Sans Bold (if none, ignore and move to next command)

    Find All Paragraph Style H1 Serif Bold xS and Change All to Word - H1 Serif Bold (if none, ignore and move to next command)

    Turn off Allow Hyphenation (if already off, ignore)

    Save in Document Manager with original filename with “(for Word)” appended at end


Any help will be greatly appreciated and rewarded with good karma...:)

Thanks,

Scott

_________________
MacBook Pro 15
2.66 Ghz Core i7
8GB RAM
10.8.3
NWP 2.0.4
iPad 3


2007-07-30 21:19:25
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
Post 
Well, if there's karma involved, here's a macro. It basically uses an attribute sensitive Find All and then applies the new style.

One thing to note: this macro does not turn off hyphenation. Currently you can't do that, you can only toggle it. If you mostly work with hyphenation on, perhaps you should add the following line to the macro:

Menu 'Allow Hyphenation'


2007-07-31 17:48:52
Profile WWW
User avatar

Joined: 2004-10-26 07:10:40
Posts: 174
Location: Tucson, AZ
Post 
Thanks so much, Martin. This is a perfect template, and I've now rewritten the macro to change all of my troublesome styles to more Word-friendly styles. Now, I have almost perfect compatibility for what I do...:)

Now, for a question. In the macro, you have the following line:

$count = Find '.+', 'aEu'

From what I understand, this declares the variable "count" and then assigns it the value of the Find results (0, 1, etc.). You applied a style to this expression in the macro. The Find expression finds any text with the style applied and then counts how many instances of that style are in the document.

Could you specifically tell me what 'aEu' means? I can't find any reference to them in the manual (but that, of course, doesn't mean they're not there).

Thanks once again, Martin. You and the others constantly remind me why Nisus is the best company around.

Scott

_________________
MacBook Pro 15
2.66 Ghz Core i7
8GB RAM
10.8.3
NWP 2.0.4
iPad 3


2007-08-01 08:01:09
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
Post 
scottwhitlock wrote:
Could you specifically tell me what 'aEu' means? I can't find any reference to them in the manual (but that, of course, doesn't mean they're not there).

No problem Scott. The 'aEu' is the options string for the Find (and Replace) command. Each letter has a specific effect:

a: Find (or replace) all matches, instead of just the next.
E: This specifies that PowerFind Pro should be used.
u: Indicates that we want attribute sensitive matching.

If you look on page 333 of the manual you should see a list of all available options.


2007-08-01 11:33:57
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: Bing [Bot] and 1 guest


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