On Saturday, Aug 16, 2003, at 22:20 Asia/Tokyo, Jonathan Levi MD wrote:
...borrowing from Kino's Nisus Macro approach, I'm attempting to rewrite my perl subscripting script dochemsubscripts.pl, as a Nisus macro:...
No. The directives should be
#!/usr/bin/perl #Nisus Macro Block #source front #destination new #Send Text as RTF #End Nisus Macro Block
Dunno about the script itself.
Kino
I have never ever posted a macro/script without testing it and still cannot avoid a bug.
Kino, it would appear that your current directives are calculated to create a new file from the entire original file. Your earlier block of directives, that I quoted, was clearly intended to take the user's selection from the current front document, copy and modify it, then paste it back into the original. while my original AppleScript/Bash-script/Perl-script trio was intended to leave the user's original file unmodifed, my attempt at a Nisus macro attempts to modify the original file. It might make sense to rewrite my entire Nisus macro to create a new file:
------------------------------------------------------------------------------
#!/usr/bin/perl
#Nisus Macro Block
#source front
#destination new
#Send Text as RTF
#End Nisus Macro Block
### dochemsubscripts.pl
# dochemsubcripts.pl -- perl script to sniff out molecular formulas in an # RTF file and insert subscript tags for the numbers, superscript tags for # ionic signs. JL 8/2003
@myfile=<STDIN>;
foreach $s (@myfile){
$s=~s/([A-Z][a-z]?[0-9]*)([+-])/$1\{\\super $2\}/g;
$s=~s/\)([+-])/\)\{\\super $1\}/g;
$s=~s/([A-Z][a-z]?)([0-9]+)/$1\{\\sub $2\}/g;
$s=~s/\)([0-9]+)/\)\{\\sub $1\}/g;
print $s;
}# end of script
------------------------------------------------------------------------------
Regarding your comment about testing scripts before posting them, I generally agree, but in this case it was impossible , as I noted in my previous post. People wishing to use my Nisus macro are warned that it is untested. As for the script trio that I originally posted, it has indeed been tested, on a limited number of files, and appears to work.
Jonathan
--------------------------------------------------- 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]
