incompatible NWE macro(s) and thanks for a major upgrade.

Get help using and writing Nisus Writer Pro macros.
Post Reply
Ruchama
Posts: 213
Joined: 2006-08-19 18:35:27

incompatible NWE macro(s) and thanks for a major upgrade.

Post by Ruchama »

More than a year ago, I have bugged martin to helped me in writing 'simple' macros which type hebrew texts. those macros have been in extensive use since then in NWE.
In the process of moving to NWP, we have discovered that all these macros are (apparently) incompatible with NWP. SInce the manual claims for compatibility I give here an example of an old macro, which still types the hebrew text, but looses all attributes.

This is done just for the sake of info, in case it interests nisus people, as I re-wrote all the macros with the new menu-driven language, and to my surprise and satisfaction- until now everything works with hebrew texts with no problem and- composition is very easy.
So this is to thank nisus people for this major upgrade- great!
#Nisus Macro Block
#Send Text as RTF
#source front selection
#destination front selection
#after execution
#Format:Remove Attributes and Styles
#Format:Paragraph Alignment:Align Right
#End Nisus Macro Block
use utf8;
binmode(STDIN, ":utf8");
binmode(STDOUT, ":utf8");

$message = '\u1492 ?\u1493 ?\u1505 ?\u1523 ?';
$fontSize = 9; # in points

$rtfSize = $fontSize * 2;
print "{\\rtf1\\mac{\\lang1037\\fs$rtfSize $message}}";
User avatar
martin
Official Nisus Person
Posts: 5227
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Post by martin »

Thanks for the post- it looks like the problem is due to a change in selection behavior for Perl macros. In Express 2.7 the text a Perl macro inserted was never selected, but in Pro (and Express 3.0) this text is selected after the macro finishes. This means the "Remove Attributes and Styles" command is then applied to the inserted text, removing the font size that had been applied.

I'll file a bug that these stand alone Perl macros should keep the behavior set forth in Express 2.7.

Also, though I know you've already transferred your macros over to the new macro style I'll give a solution in case anyone else has the issue. Simply insert the command "Select End" at the start of the "after execution" block. Eg: your example macro becomes:

Code: Select all

#Nisus Macro Block 
#Send Text as RTF 
#source front selection 
#destination front selection 
#after execution 
#Select End
#Format:Remove Attributes and Styles 
#Format:Paragraph Alignment:Align Right 
#End Nisus Macro Block 
use utf8; 
binmode(STDIN, ":utf8"); 
binmode(STDOUT, ":utf8"); 

$message = '\u1492 ?\u1493 ?\u1505 ?\u1523 ?'; 
$fontSize = 9; # in points 

$rtfSize = $fontSize * 2; 
print "{\\rtf1\\mac{\\lang1037\\fs$rtfSize $message}}"
Post Reply