Move selected text to the left or right

Hotkeys: Alt+Left Arrow to move text to the left; Alt+Right Arrow to move text to the right. The script includes both hotkeys.

Select the text to be moved. Use the hotkey (without releasing the Alt key) to move the caret to the position where you want to paste the text. Once you're there, release the Alt key to paste the text.

!Left::
!Right::
if(!x){
send ^x
hotkey,Alt up,paste,on
x:=1
}
send % "^{" . subStr(a_thisHotkey,2) . "}"
return

paste:
hotkey,Alt up,paste,off
x:=0
send ^v
return

 

Parents
  • Fantastic!  As I write, you wrote this post more than two years ago.

    I've been writing autohotkey scripts since 2008, but your script here blew me away!!

    I have never used the hotkey command and as I write I haven't yet looked at docs to see how this works. 

    But, thank you!

    There is much to learn here and I sense this technique can be used to solve many problems.

Reply
  • Fantastic!  As I write, you wrote this post more than two years ago.

    I've been writing autohotkey scripts since 2008, but your script here blew me away!!

    I have never used the hotkey command and as I write I haven't yet looked at docs to see how this works. 

    But, thank you!

    There is much to learn here and I sense this technique can be used to solve many problems.

Children
No Data