Macros in 2.5
Macros in 2.5
Just out of curiosity, have there been any changes to the macro capability in 2.5? I know in an earlier message, it was suggested that you want to make it work with all shell languages (Ruby, Python, etc.) as well as expanding the AppleScript dictionary.
As I recall, the Perl macros didn't work completely as documented as it was in 2.1, and a way to more gracefully handle formatted text would still be nice. :)
(I haven't used NWX in a bit, but that's because I haven't been doing much word processing in a bit -- it's still my favorite word processor on OS X.)
As I recall, the Perl macros didn't work completely as documented as it was in 2.1, and a way to more gracefully handle formatted text would still be nice. :)
(I haven't used NWX in a bit, but that's because I haven't been doing much word processing in a bit -- it's still my favorite word processor on OS X.)
creating Macros
How difficult is it to write a script or macro
I would like to have a script that transposes words
so you would have
tired dog
and the macro would make it
dog tired
thanks
I would like to have a script that transposes words
so you would have
tired dog
and the macro would make it
dog tired
thanks
I have never let my schooling interfere with my education/Mark Twain (1835-1910)
Re: creating Macros
Or why not a script that transposes letters as in old NW. I hope it's not rocket science.gemboy27 wrote: I would like to have a script that transposes words
Peter Edwardsson
..............................
..............................
Re: creating Macros
how about this, is there a site that shows how to make macros, so I can try to figure out how to transpose words or characters?MacSailor wrote:Or why not a script that transposes letters as in old NW. I hope it's not rocket science.gemboy27 wrote: I would like to have a script that transposes words
gm 27
I have never let my schooling interfere with my education/Mark Twain (1835-1910)
Re: creating Macros
How often do you do this? Just curious...gemboy27 wrote:How difficult is it to write a script or macro
I would like to have a script that transposes words
so you would have
tired dog
and the macro would make it
dog tired
thanks
is once a day enough
I don't know, it isn't a daily thing, because my bigger writing projects come all at once, then it is four or five times a day, especially when it comes to transposing characters
I use the quick fix to automatically change 'teh' to 'the'
I guess I try to type fast and the results is the need to transpose...
why do you aks
I use the quick fix to automatically change 'teh' to 'the'
I guess I try to type fast and the results is the need to transpose...
why do you aks
I have never let my schooling interfere with my education/Mark Twain (1835-1910)
Re: is once a day enough
You don't even have to do that. On OS X, cntrl-t will reverse two letters. If you type "teh," just stick the cursor between the "e" and the "h" and press cntrl-t. The two letters will be transposed.gemboy27 wrote: I use the quick fix to automatically change 'teh' to 'the'
Re: is once a day enough
I write a lot as well and never transpose words, characters may get transposed at a rate of one per month...just curious. Thnaks.gemboy27 wrote:I don't know, it isn't a daily thing, because my bigger writing projects come all at once, then it is four or five times a day, especially when it comes to transposing characters
I use the quick fix to automatically change 'teh' to 'the'
I guess I try to type fast and the results is the need to transpose...
why do you aks
Re: thanks
You know, I can't remember where I picked that one up. It's just one of those things...like holding down the command key and moving windows in the background or using keyboard shortcuts (cmd-W, cmd-O, cmd-M, cmd-shift-A/H/C, etc.)gemboy27 wrote:hmmm where can you get a list of those OSX tricks
??
You might try MacOSXHints.
Missing an integrated macro language
One of my disappointments with Nisus Writer Express is that is doesn't have it's own macro language. Nor is there much documentation about how to use perl with Nisus (sheesh! I have to learn yet another programming language?! -- I just want to get some writing chores done!).
I've only come over to the Mac since OS X, so I never had the fortune to use the old Nisus, but apparently it had its own killer macro language that was fully integrated into (old) Nisus' commands and so on -- much like VBA works in Word. Right? So why can't we have something like that for NWE? Using a general purpose programming/scripting language to write NWE-specific macros sounds like a real kludge to me. What do the macro aces think about this? Am I missing something?
I've only come over to the Mac since OS X, so I never had the fortune to use the old Nisus, but apparently it had its own killer macro language that was fully integrated into (old) Nisus' commands and so on -- much like VBA works in Word. Right? So why can't we have something like that for NWE? Using a general purpose programming/scripting language to write NWE-specific macros sounds like a real kludge to me. What do the macro aces think about this? Am I missing something?
Re: Missing an integrated macro language
But if NWX had it's own scripting language you'd still have to "learn another programming language": NWX's language. Using Perl means leveraging a language that's public, open source, has a large and flexible set of text manipulation facilities and is already familiar to many people. It makes much more sense than creating yet another proprietary "Nisus-only" scripting language users have to learn just for NWX. Applescript is also available and, aside from not being open source, has much the same advantages as Perl -- lots of users already know it. Using pre-existing widely used scripting languages like Perl and Applescript instead of reinventing the wheel is the macro equivalent of using RTF as the file format -- it doesn't lock you in.riccardo wrote:One of my disappointments with Nisus Writer Express is that is doesn't have it's own macro language. Nor is there much documentation about how to use perl with Nisus (sheesh! I have to learn yet another programming language?! -- I just want to get some writing chores done!).
I've only come over to the Mac since OS X, so I never had the fortune to use the old Nisus, but apparently it had its own killer macro language that was fully integrated into (old) Nisus' commands and so on -- much like VBA works in Word. Right? So why can't we have something like that for NWE? Using a general purpose programming/scripting language to write NWE-specific macros sounds like a real kludge to me. What do the macro aces think about this? Am I missing something?
People keep saying that there's not much info on writing Perl macros for NWX but there's actually quite a lot: the NWX User Guide explains the architecture, macro directives and what they do, how to invoke existing macros from your macro, etc. Then there's a bunch of supplied Perl macros that you can examine and modify to your heart's content. There's links to Perl courses and docs you can use to learn Perl and find out what text manipulation commands it has and what you can do with them.
Re: creating Macros
Here's a NWX Perl script that transposes selected words as requested:gemboy27 wrote:How difficult is it to write a script or macro
I would like to have a script that transposes words
so you would have
tired dog
and the macro would make it
dog tired
thanks
#Nisus Macro Block
#source clipboard
#destination clipboard
#before execution
#Copy
#after execution
#Paste
#End Nisus Macro Block
while (my $line = <>) {
my @wordArray = split(" ", $line);
print join(" ", reverse(@wordArray));
}
Unfortunately it adds an extra space to the end of the transposed text when it pastes it back into the document from the clipboard but I seem to recall that's a known issue with Paste in NWX 2.1.x (I haven't tried 2.5b, hopefully it's fixed there).
I wrote the above macro today, having virtually zero knowledge of Perl when I started, using the documentation in the NWX User Guide, a course -- "Practical Perl Programming" -- I found at: www.cs.cf.ac.uk/Dave/PERL/perl_caller.html
and looking at some of the Perl macros that come with NWX.
The point is that it's really not that hard to write simple NWX macros, even if you don't know Perl, using the NWX documentation and public Perl resources. It does help to have used other programming/scripting languages such as C, Java, Javascript, Tcl, csh or bash, etc. before though. If you've never programmed before it'd be considerably more difficult I imagine.
wow!
thank you for the script
and thank you for the link
if anyone wants to use it, you have to highlight both words. And it doesn't add the space
it is fun
tired dog tired dog
becomes
dog tired dog tired
not to mention
tired dog becomes dog tired
yes, thanks again
and thank you for the link
if anyone wants to use it, you have to highlight both words. And it doesn't add the space
it is fun
tired dog tired dog
becomes
dog tired dog tired
not to mention
tired dog becomes dog tired
yes, thanks again
I have never let my schooling interfere with my education/Mark Twain (1835-1910)
Speaking of the space
I have some macros that I wrote to add "canned" comments to papers I am grading. I do not want them to add a space in front of the pasted text, but they do. Does anyone know a trick to make that stop or is that the bug reappearing in a new place.
Jeffrey Zents
jzents@mac.com
jzents@mac.com