|Save for Word Macro
|Page 1 of 1|
|Author:||scottwhitlock [ 2007-07-30 21:19:25 ]|
|Post subject:||Save for Word Macro|
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 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
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...
|Author:||martin [ 2007-07-31 17:48:52 ]|
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'
|Author:||scottwhitlock [ 2007-08-01 08:01:09 ]|
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.
|Author:||martin [ 2007-08-01 11:33:57 ]|
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.
|Page 1 of 1||All times are UTC - 8 hours|
|Powered by phpBB® Forum Software © phpBB Group