ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

Free Windows Text Editor that transposes last 2 characters typed on Control-t ??

<< < (2/3) > >>

skwire:
There is no need to use the clipboard.  Consider the following AHK code:


--- Code: Autohotkey ---Loop{    Key_3 := Key_2, Key_2 := Key_1    Input, Key_1, V I L1}Return  ^t::{    SendInput, {Backspace 2}    SendInput, % Key_2 . Key_3}Return
The above snippet should work anywhere to swap the last two typed characters without using the clipboard.  Alternately, you could easily restrict it down to only certain applications.  Obviously, minimal testing has been done with this but it seems to work pretty well.

AndyM:
There is no need to use the clipboard.
-skwire (July 24, 2010, 01:40 AM)
--- End quote ---

That's much better!

MilesAhead:
Thanks for the macro and ahk code. :)

edit: thanks skwire.  Tried it in EditPadLite and it worked.  :)

MilesAhead:
I just added a few lines to restrict the windows to a group of editors using the class names.

edit: added Chrome and Firefox browsers to the window group


--- ---GroupAdd,EditorGroup, ahk_class TFormEditPadLite  ;EditPadLite
GroupAdd,EditorGroup, ahk_class wxWindowClassNR   ;FBIde
GroupAdd,EditorGroup, ahk_class SciTEWindow       ;Scite
GroupAdd,EditorGroup, ahk_class MAINFBEDIT        ;FBEdit
GroupAdd,EditorGroup, ahk_class Notepad           ;Notepad
GroupAdd,EditorGroup, ahk_class TFormMain         ;TreePad
GroupAdd,EditorGroup, ahk_class Chrome_WidgetWin_0   ;Chrome Browser
GroupAdd,EditorGroup, ahk_class MozillaUIWindowClass ;Firefox Browser

Loop
{
    Key_3 := Key_2, Key_2 := Key_1
    Input, Key_1, V I L1
}
Return

#IfWinActive, ahk_group EditorGroup
^t::
{
    SendInput, {Backspace 2}
    SendInput, % Key_2 . Key_3
}
Return

skwire:
Thanks for the macro and ahk code. :)

edit: thanks skwire.  Tried it in EditPadLite and it worked.  :)-MilesAhead (July 25, 2010, 05:09 PM)
--- End quote ---

You're welcome.  Happy to help.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version