Reversing Character

Get help using and writing Nisus Writer Pro macros.
Post Reply
Posts: 39
Joined: 2010-01-06 10:58:07

Reversing Character

Post by bjast »

Has anyone ever developed a macro that reverses characters?

For example:

theer > there

whele > wheel

ohlding > holding

As I've gotten older I'm finding I'm making this kind of mistake more often.


Posts: 400
Joined: 2008-05-17 04:02:32

Re: Reversing Character

Post by Kino »

bjast wrote:As I've gotten older I'm finding I'm making this kind of mistake more often.
Same here ;-( Or worse: it is getting harder and harder for me to detect typos.

In the past, a similar problem was discussed at:
To sum up, if you want to swap a character before the insertion point with a character after it, just hit control-t which is a built-in Cocoa keybinding, working in all Cocoa applications. However, if you want to reverse two characters before the insertion point, you need something else.

Here is yet another macro attempt for the latter case, the laziest one ;-)

Code: Select all

Send Selector 'moveBackward:'
Send Selector 'transpose:'
As the macro above just call Cocoa actions via Send Selector command, it is easy to enable the same functionality in all Cocoa applications by putting a custom keybindings dictionary (DefaultKeyBinding.dict) in /Users/you/Library/KeyBindings/. Attached is a sample dictionary file. It is a text file you can edit, for example, in TextEdit.

Code: Select all

	"^'" = (
"^'" defines the key combination (control-') assigned to this functionality. To execute it by another key combination, just change "^'":

Code: Select all

^: control key
$: shift key
@: command key
~: option key
For example, "^a" for control-a, "^$n" for control-shift-n.
(640 Bytes) Downloaded 342 times

Post Reply