|Macro to Traspose Characters
|Page 1 of 1|
|Author:||lawrencegoodman [ 2007-08-07 13:13:19 ]|
|Post subject:||Macro to Traspose Characters|
I want to write a macro where it changes the order of two letters. So if the cursor is between the 't' and 'h' in the word 'the' and I trigger the macro, the word will change to 'hte'.
I have written the following macro:
I get an error because evidently you can't use negative numbers. So how do I move backwards one space? I am trying to do this without perl if I can so I can keep it simple and understand what I am doing.
Thanks for your help.
|Author:||martin [ 2007-08-07 13:52:13 ]|
|Post subject:||Re: Macro to Traspose Characters|
Correct, the Set Selection Location command takes an absolute character location/offset in the document. Thus if your document contains (N) characters then only (1) through (N + 1) are valid locations.
As macros currently do not have any commands that perform arithmetic you'll have to resort to Perl to calculate the character location you need. However, I think you'll find the code understandable:
|Page 1 of 1||All times are UTC - 8 hours|
|Powered by phpBB® Forum Software © phpBB Group