E1M1 Posted April 19, 2009 Share Posted April 19, 2009 How do I get selected text from edit control?I have GUI with edit control, and I select some some text there. Now I want get that selected text, how could I do it? I have gui that is similar to window's notepad, but I cant find code for "copy" button only code I invent was send("^c") , but I need other than send. edited Link to comment Share on other sites More sharing options...
monoceres Posted April 19, 2009 Share Posted April 19, 2009 _GUICtrlEdit_GetSel(). Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
E1M1 Posted April 19, 2009 Author Share Posted April 19, 2009 _GUICtrlEdit_GetSel().Return Value Success: Array in the following format: [0] - Starting position [1] - Ending positionIt return position but I want get text, then I still need function to get all char(s) from $pos[0] to $pos[1] edited Link to comment Share on other sites More sharing options...
martin Posted April 19, 2009 Share Posted April 19, 2009 It return position but I want get text, then I still need function to get all char(s) from $pos[0] to $pos[1] If you know the first position and the last then there's not muchmore to figure out. $range = _GUICtrlEdit_GetSel(GUICtrlGetHandle($Edit1)) If $range[0] <> $range[1] Then $SelectedText = StringMid(GUICtrlRead($Edit1), $range[0] + 1, $range[1] - $range[0])) EndIf Or something pretty close to that. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
E1M1 Posted April 19, 2009 Author Share Posted April 19, 2009 thanks! It was easy and working solution edited Link to comment Share on other sites More sharing options...
myspacee Posted May 13, 2015 Share Posted May 13, 2015 Hello,sorry for take back this post. I used MVPs code:$range = _GUICtrlEdit_GetSel(GUICtrlGetHandle($Edit1)) $range = _GUICtrlEdit_GetSel(GUICtrlGetHandle($Edit1)) If $range[0] <> $range[1] Then $SelectedText = StringMid(GUICtrlRead($Edit1), $range[0] + 1, $range[1] - $range[0])) EndIfthis works perfectly to obtain selected text. Now, how replace text in same position ?eg:- i select letter Y form : New York- recover selection with above code- replace selection in that point with different letter : New Zork thank you,m. Link to comment Share on other sites More sharing options...
MikahS Posted May 13, 2015 Share Posted May 13, 2015 This is a 6 year old topic, my suggestion would have been to start a new topic.But, just use the function :_GUICtrlEdit_ReplaceSel(GUIctrlGetHandle($Edit1), "Z")instead. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
myspacee Posted May 13, 2015 Share Posted May 13, 2015 Thank you,it wore perfectly, sorry for retake post.m. Link to comment Share on other sites More sharing options...
MikahS Posted May 13, 2015 Share Posted May 13, 2015 Glad it helped. For next time. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now