3

In my autohotkey script I've created the following hot keys that I thought would allow me to move my cursor to the end of a line or beginning of a line instead of using Home and End.

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and 
reliability.
 SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

^Right::End
^Left::Home

Unfortunately what this actually does is move the cursor to the beginning or end of the entire text file. I've tested this in multiple text editors and the result is the same.

I haven't been able to Google or see in the documentation anything about a "EOL" character.

Have I done this right and this is just the nature of the beast or is there another way to accomplish what I'm trying to do?

1
  • AHK is sending correct key but when key is send, Ctrl is already pressed. And Editor see it as Ctrl + Home or Ctrl + End. Which is shortcut to move cursor to start or end of file.
    – Sandeep
    Jul 5, 2018 at 14:19

3 Answers 3

4

AHK is sending correct key but when key is send, Ctrl is already pressed. And Editor see it as Ctrl + Home or Ctrl + End. Which is shortcut to move cursor to start or end of file.

I was able to make it work by using SetKeyDelay along with Send. You may try following script.

SetKeyDelay, 500, 10
^Right::Send {End}
^Left::Send {Home}
0
1

Try this:

^left::
    send {home}
return

^right::
    send {end}
return
1
  • Thank you, it works for me, also in the form ::send {End} on same line with no return.
    – gsl
    Mar 5, 2019 at 14:46
0

works for me:

!h::Send {HOME}     ; h     ALT + RIGHT (Cursor to beginning of line)
;!~::Send {END}      ; ; ALT + LEFT  (Cursor to end of line)
!~::Send {END}      ; ; ALT + LEFT  (Cursor to end of line)
2
  • 1
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Feb 11 at 22:27
  • I use left ALT-h in windows to go to start of line and ALT-~to go to end of line. Just insert at end of script. I don´t have documentatio,it was try and error. And I just want to help. If there is any problem I can remove the answer, no problem. Thanks in advance.
    – pkanda
    Feb 13 at 14:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .