Code: Select all
Left::
Send {Right}
Send ^{Left}
Send {Left}
Send ^+{Left}
Return
Right:
Send {Left}
Send ^{Right}
Send ^{Right}
Send {Left}
Send ^+{Left}
Return
Code: Select all
Left::
Send {Right}
Send ^{Left}
Send {Left}
Send ^+{Left}
Return
Right:
Send {Left}
Send ^{Right}
Send ^{Right}
Send {Left}
Send ^+{Left}
Return
Code: Select all
Left:: ;Edit control - set selection to previous word
Right:: ;Edit control - set selection to next word
ControlGet, hCtl, Hwnd,, Edit1, A
SendMessage, 0xB1, -1, 0,, % "ahk_id " hCtl ;EM_SETSEL := 0xB1 ;deselect text
SendInput, % InStr(A_ThisHotkey, "Left") ? "^+{Left}" : "^+{Right}"
return
;some text for testing:
;aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa
;aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa
;aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa
;aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa
If the start is 0 and the end is –1, all the text in the edit control is selected. If the start is –1, any current selection is deselected.
Code: Select all
Gui, Add, Edit, r9 vMyEdit w135, The problem with this is it stops working when you try to go past the first or last word.
Gui, Show
Left::
X := A_CaretX, Y := A_CaretY
Send {Right}
Send ^{Left}
Send {Left}
Send ^+{Left}
If (X = A_CaretX And Y = A_CaretY)
{
Send ^{End}
Goto Right
}
Return
Right::
X := A_CaretX, Y := A_CaretY
Send {Left}
Send ^{Right}
Send ^{Right}
Send {Left}
Send ^+{Left}
If (X = A_CaretX And Y = A_CaretY)
{
Send ^{Home}^{Right}
Goto Left
}
Return
Code: Select all
Gui, Add, Edit, r9 vMyEdit w135 +hwndhctl, T problem w this is it stops working when x you try to go past the first or last w
Gui, Show
Left::
X := A_CaretX, Y := A_CaretY
Send {Right}
Send ^{Left}
Send {Left}
Send ^+{Left}
Sleep, 1 ; A_Caret* is a little slow
If (X = A_CaretX And Y = A_CaretY)
{
Send ^{Right}
Send {Left}
Send +{Home}
}
Return
Right::
firstchar := 0, lastchar := 0
SendMessage, 0xB0, &firstchar, &lastchar,, % "ahk_id " hctl ; EM_GETSEL - can get the length of selected text
If (Asc(lastchar) - Asc(firstchar) > 1) ; if I don't do this, it skips words following one-character words ; Asc is probably not the right way to read a DWORD
Send {Right}
Send ^{Right}
Send ^+{Right}
X := A_CaretX, Y := A_CaretY ; check if we're at the end of the text
Send {Right}
Sleep, 1
If !(X = A_CaretX And Y = A_CaretY)
Send {Left 2} ; we've gone one word too far
Send ^+{Left}
Return
Users browsing this forum: No registered users and 301 guests