macros

Have a problem? A question? This is the place for answers from other Express users.
Post Reply
sscpord
Posts: 3
Joined: 2006-03-10 01:22:30

macros

Post by sscpord »

Hi all

Is it at all possible to convert the
macro's that i have built up in Nisus Writer 5.1 and use them in
Nisus Writer Express

for example

Replace All "COLLEGE" "Coll" "oO-SAi-wt-G-g"
Replace All "PRIMARY SCHOOL" "Prim Sch" "oO-SAi-wt-G-g"
Replace All "Higher Education Centre" "H Ed Ctr" "oO-SAi-wt-G-g"

Any help would be appreciated

Thanks

Derek
HeatherKay
Posts: 78
Joined: 2004-04-13 04:44:40
Location: Chatham, UK
Contact:

Post by HeatherKay »

:shock:

If I understand you, you're typing "H Ed Ctr" as a shortform of Higher Education Centre, and then using the macro to find and replace?

If that is so, you might try adding your "shortcuts" to the Instant Fix list under Preferences. So, if you added "HEdCtr" or similar, NWE would automatically expand it as you typed.

Of course, I may well be barking up completely the wrong tree.

:wink:
midwinter
Posts: 333
Joined: 2004-09-09 18:07:11
Location: Utah
Contact:

Post by midwinter »

That's what I tend to do if I find myself typing long phrases over and over again.
sscpord
Posts: 3
Joined: 2006-03-10 01:22:30

Post by sscpord »

I appreciate your help butmaybe i need to clarify things a little. I hav a macro setup in nisus 5.1 that looks though a text file and replaces SCHOOL with SCH but only if the word SCHOOL is art the end of a feature.

For example:-

MANOR PARK SCHOOL would become MANOR PARK SCH but

MANOR SCHOOL ROAD would be left as MANOR SCHOOL ROAD.

Is there a way to do the same functionality in Nisus Writer Express and have the macro being called into play by an applescript
cchapin
Posts: 424
Joined: 2004-02-25 18:28:40
Location: Nagoya, Japan

Post by cchapin »

I think that this could be done with Perl. But I couldn't tell you how to write the Perl macro. I'm less certain that AppleScript could do what you want, but I'm certainly no AppleScript expert. The downside to using Perl, as I understand it, is that at this point in time it will strip out formatting and styles. Is that a problem for you?

--Craig
sscpord
Posts: 3
Joined: 2006-03-10 01:22:30

Post by sscpord »

Stripping out te formatting and the style is not a problem at all

Derek
cchapin
Posts: 424
Joined: 2004-02-25 18:28:40
Location: Nagoya, Japan

Post by cchapin »

Here is a very simple macro you could use to change SCHOOL to SCH when it occurs just before a return (i.e., at the end of a paragraph) but not in the middle of a line. I used the text replacement template supplied by Nisus and changed only two lines. Modify the macro to your heart's content.

Code: Select all

#Nisus Macro Block
#source clipboard
#destination clipboard
#Before Execution
#Select All
#Clipboard 1
#Copy
#After Execution
#Paste
#Clipboard 0
#End Nisus Macro Block

#This macro template lets you replace text with other text
#You can use regular expressions to do text pattern matching

while (my $line = <>) { #Reads each line of the selection from the clipboard
	$line =~ s/SCHOOL\s*\n/SCH\n/ig;
#	Replace the words with the expressions
#	Repeat the whole line starting "$line =~ " above for multiple replacements
	print $line; #writes out each line to the clipboard
}
--Craig
Post Reply