E1M1 Posted April 20, 2009 Share Posted April 20, 2009 (edited) Is there any command or method how to goto given line in edit control? Only thing I came up with was _GUICtrlEdit_LineScroll($Edit1, 10, 10) but this command onlyscrols text, but it dont move your cursor on that line Edited April 20, 2009 by E1M1 edited Link to comment Share on other sites More sharing options...
GEOSoft Posted April 20, 2009 Share Posted April 20, 2009 Help File >> ControlCommand() George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Authenticity Posted April 20, 2009 Share Posted April 20, 2009 #include <EditConstants.au3> Dim $hGUI = GUICreate('GUI', 350, 200) Dim $Edit = GUICtrlCreateEdit('', 0, 0, 350, 200) For $i = 1 To 20 GUICtrlSetData($Edit, 'The quick brown fox jumps over the lazy dog' & @CRLF, 1) Next GUISetState() GUICtrlSendMsg($Edit, $EM_SETSEL, 150, 150) Do Until GUIGetMsg() = -3 GUIDelete() Link to comment Share on other sites More sharing options...
Valuater Posted April 20, 2009 Share Posted April 20, 2009 try.. GUICtrlSendMsg($Edit, $EM_SETSEL, 150, 180) 8) Link to comment Share on other sites More sharing options...
E1M1 Posted April 20, 2009 Author Share Posted April 20, 2009 (edited) it won't go to given line go goes to given char. I have seen some scripts that have DllStruct* commands and DllCall commands... but can someone make similar thing for going to line? I wonder why autoit dont have command for so usual operation. Edit is 1 of the most used GUI element, and autoit just dont have full support for it.... Edited April 20, 2009 by E1M1 edited Link to comment Share on other sites More sharing options...
Valuater Posted April 20, 2009 Share Posted April 20, 2009 You are not giving enough info, or script, to make a reasonable effort to help you.. We do not read minds 8) Link to comment Share on other sites More sharing options...
Authenticity Posted April 20, 2009 Share Posted April 20, 2009 $iPos = GUICtrlSendMsg($Edit, $EM_LINEINDEX, 9, 0) GUICtrlSendMsg($Edit, $EM_SETSEL, $iPos, $iPos) Link to comment Share on other sites More sharing options...
Valuater Posted April 20, 2009 Share Posted April 20, 2009 $iPos = GUICtrlSendMsg($Edit, $EM_LINEINDEX, 9, 0) GUICtrlSendMsg($Edit, $EM_SETSEL, $iPos, $iPos) Well, you got someone to guess.... ... did that do the trick? 8) Link to comment Share on other sites More sharing options...
E1M1 Posted April 21, 2009 Author Share Posted April 21, 2009 Thanks but where from do you learn tings like $EM_SETSEL and $EM_LINEINDEX? I cant see those variables in help file. edited Link to comment Share on other sites More sharing options...
Mat Posted April 21, 2009 Share Posted April 21, 2009 http://msdn.microsoft.com/en-us/library/cc656458(VS.85).aspxthat help? AutoIt Project Listing Link to comment Share on other sites More sharing options...
E1M1 Posted April 21, 2009 Author Share Posted April 21, 2009 yep this is what i was looking for edited Link to comment Share on other sites More sharing options...
Mat Posted April 21, 2009 Share Posted April 21, 2009 Sorry to bump a complet-ish topic, but: how can I search for a word in an edit and then highlight it + scroll to it? I can search, and I can highlight chars and scroll to them, but I don't know how to search and return the character #... some help would be appreciated... Mdiesel AutoIt Project Listing Link to comment Share on other sites More sharing options...
E1M1 Posted April 21, 2009 Author Share Posted April 21, 2009 (edited) #Include <GuiEdit.au3> _GUICtrlEdit_Find($hWnd[, $fReplace = False]) it will also highlight (actually mark) the string or you can write ur own richtext control. Edited April 21, 2009 by E1M1 edited Link to comment Share on other sites More sharing options...
Authenticity Posted April 21, 2009 Share Posted April 21, 2009 expandcollapse popup#include <EditConstants.au3> #include <GuiConstants.au3> #include <WindowsConstants.au3> HotKeySet('^f', 'Find') Dim $iCase = 0, $iCurrent = 0, $iPos = 0 Dim $sEdit = '', $sSearch = '' Dim $hGUI = GUICreate('GUI', 350, 200) Dim $Edit = GUICtrlCreateEdit('', 0, 0, 350, 200) Dim $hFindGUI = GUICreate('Search', 200, 120, 50, 50, BitOR($WS_POPUPWINDOW, $WS_CAPTION), $WS_EX_TOOLWINDOW, $hGUI) Dim $EditSearch = GUICtrlCreateEdit('', 20, 20, 160, 25, 0) Dim $CheckCaseSensitive = GUICtrlCreateCheckbox('&Use case-sensitive search', 20, 50) Dim $ButtonFindNext = GUICtrlCreateButton('&Next', 30, 90, 60, 25) GUISwitch($hGUI) For $i = 1 To 20 GUICtrlSetData($Edit, 'The quick brown fox jumps over the lazy dog' & @CRLF, 1) Next GUISetState() GUICtrlSendMsg($Edit, $EM_SETSEL, 0, 0) While 1 Local $Msg = GUIGetMsg(1) Select Case $Msg[0] = $GUI_EVENT_CLOSE And $Msg[1] = $hGUI ExitLoop Case $Msg[0] = $GUI_EVENT_CLOSE And $Msg[1] = $hFindGUI GUISetState(@SW_HIDE, $hFindGUI) Case $Msg[0] = $ButtonFindNext $sSearch = GUICtrlRead($EditSearch) $sEdit = GUICtrlRead($Edit) If $sSearch <> "" Then $iPos = StringInStr($sEdit, $sSearch, $iCase, 1, $iCurrent) ConsoleWrite($iPos) GUICtrlSetState($Edit, $GUI_FOCUS) If $iPos Then GUICtrlSendMsg($Edit, $EM_SETSEL, $iPos-1, $iPos+StringLen($sSearch)-1) EndIf Case $CheckCaseSensitive If GUICtrlRead($CheckCaseSensitive) = $GUI_CHECKED Then $iCase = 1 Else $iCase = 0 EndIf EndSelect WEnd GUIDelete() Func Find() $iCurrent = BitAND(GUICtrlSendMsg($Edit, $EM_GETSEL, 0, 0), 0xFFFF)+1 GUISetState(@SW_SHOW, $hFindGUI) EndFunc Link to comment Share on other sites More sharing options...
Mat Posted April 21, 2009 Share Posted April 21, 2009 Very nice, but next doesn't find next... it repeats the current. AutoIt Project Listing Link to comment Share on other sites More sharing options...
Authenticity Posted April 21, 2009 Share Posted April 21, 2009 Yes, just change the $iCurrent on success to $iPos+StringLen($sSearch). ;] Link to comment Share on other sites More sharing options...
Valuater Posted April 21, 2009 Share Posted April 21, 2009 (edited) It did not work for me??? ... awh... hotKey() 8) EDIT.... Very Nice Authenticity!! Edited April 21, 2009 by Valuater 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