The massive power outage has prevented me from responding and I would like to thank all who responded. It is strange that the #send text as RTF directive sends the entire file. This was my problem. All I got back from my macro was a bunch of numbers. I don't know why the Nisus developers did this but it is clear that Nisus Writer Express needs a lot of work in the macro department. In my opinion the current macro ability of the Nisus Writer OSX cannot begin to compare to the power of macros in 6.x. I switched to Nisus many years ago because of the strong macro support. I hope the engineers give this deficiency top priority. The consensus of the list seems to be that there is no easy way to do what I want easily, if there is even a way. Guess I'll just do subscripts and superscripts one by one until the problem is fixed. If the Nisus engineers could just fix the #send text as RTF so that only selected text would be sent, it would go a long way to fixing many problems. Thanks again.

On Thursday, August 14, 2003, at 10:26 AM, Kino wrote:

On Thursday, Aug 14, 2003, at 20:04 Asia/Tokyo, Patrick Gormley wrote�:

Has anyone had success in writing a Perl macro that sends the selected text to the macro as RTF (using the #send RTF) option and having the text returned and formatted as RTF?

No. I ported smart/straight quotes macros to NW Express using that macro directive:
<http://quinon.com/files/nisus_files/NWExpressMacros/ RTF_SmartQuotes.pl.sit>
<http://quinon.com/files/nisus_files/NWExpressMacros/ RTF_StraightQuotes.pl.sit>
But '#Send Text as RTF' does not send the selection but the entire file as RTF. So it is usable only when you'd like to process the whole file.



I am a chemistry teacher and would like to design a macro that would take text like Na2SO4 and have the macro drop all numbers to subscripts.

A workaround would be to use real subscript characters U+2080-U+2089 instead of subscript style. Unfortunately, among OS X fonts installed by default, only Skia and some Japanese fonts support those characters and I'm afraid you'll find them not so *sub*. AFAIK Gentium font looks nice. It's free.
<http://www.sil.org/~gaultney/gentium/>


If you find it good, type "Na2SO4" with Gentium, select "Na2SO4" and run the following macro.

#! /usr/bin/perl

#Nisus Macro Block
#source clipboard
#destination clipboard
#before execution
#Copy
#after execution
#Paste
#End Nisus Macro Block

### Num2Sub.pl

use strict;
use warnings;

my $str = "";

local undef $/;
$str = <STDIN>;

if ( $str eq "" ) {
        print STDERR "Num2Sub.pl: Nothing selected!\n";
        exit;
}

$str =~ s/(\d)/\xE2\x82$1/g;
$str =~ tr/[0-9]/[\x80-\x89]/;
# tr [0-9] into [\xE2\x82\x80-\xE2\x82\x89],
# i.e. U+2080-U+2089

print $str;

# end of script


With the current NW Express macro, you cannot check if something is selected or not. So if the clipboard in NOT empty, the content of the clipboard will be pasted even if nothing is selected actually in the edit window. That's a serious defect.



Kino












---------------------------------------------------
The Nisus Interactive List
[EMAIL PROTECTED]

Searchable archives:
http://www.mail-archive.com/nisus-interactive%40nisus.com/

To unsubscribe from this list please send a message with "unsubscribe
nisus-interactive" in the body of the email to [EMAIL PROTECTED]




--
Patrick Gormley
Lapeer East High School
Lapeer MI 48446
http://chem.lapeer.org
---Lord, help me go the distance. I want to cross the finish line, not riding, or coasting, but running.



--------------------------------------------------- The Nisus Interactive List [EMAIL PROTECTED]

Searchable archives:
http://www.mail-archive.com/nisus-interactive%40nisus.com/

To unsubscribe from this list please send a message with "unsubscribe
nisus-interactive" in the body of the email to [EMAIL PROTECTED]




Reply via email to