Code: Select all
ControlGet,count,CurrentLine,,Edit1, ahk_class Notepad
ControlGet,text,Line,% count,Edit1, ahk_class Notepad
Msgbox % text
Code: Select all
ControlGet,count,CurrentLine,,Edit1, ahk_class Notepad
ControlGet,text,Line,% count,Edit1, ahk_class Notepad
Msgbox % text
Code: Select all
Send ^{right}^+{left}^c{right} ;move to end of word, move to start of word, selecting text, copy, leave cursor at end of word.
sleep, 100 ; wait for clipboard to update
If (SubStr(clipboard, 0) = " ") ;check if space at end of clipboard, if so remove it
StringTrimRight, clipboard, clipboard, 1
MsgBox % clipboard
return
Is there any particular reason? I don't know if that's possible or not, but I suspect it may well not be, and this works for sure.xuezhe wrote:@SifJar
thx.but I wish it coded using window api.
Code: Select all
ControlGet,count,CurrentLine,,Edit1, ahk_class Notepad
ControlGet,text,Line,% count,Edit1, ahk_class Notepad
CaretX := floor(A_CaretX/8)
if RegExMatch(text, "^.{0," CaretX "}\h+\K\S+", Word)
MsgBox % Word
did you try it on Notepad per your original example?xuezhe wrote:@AlphaBravo thx.but it only gets the last word.
Code: Select all
MsgBox % A_CaretX
Code: Select all
ControlGet,count,CurrentLine,,Edit1, ahk_class Notepad
ControlGet,text,Line,% count,Edit1, ahk_class Notepad
ControlGet,count,CurrentCol,,Edit1, ahk_class Notepad
RegExMatch(SubStr(text,1,count-1),"([^,,\s\.\t]*$)",str)
RegExMatch(SubStr(text,count),"^[^,,\s,\.\t]*",string)
word:=str string
MsgBox % word