atomman Posted December 18, 2007 Share Posted December 18, 2007 (edited) i probably re-invented the wheel here, but i couldn't find anything i liked. besides, it was fun! 2 edit controls, side by side. 1st holds numbers (read only, disabled), second is regular edit control with scroll bars. GUI is resizable. problems: 1) adding lines works fine, but when backspacing in the main edit ctrl, script has to re-draw all the numbers. sure, can drop the 20ms sleep, but this doesn't solve the core problem. 2) using the UP arrow in the main edit ctrl adjusts the line numbers and this is not what i want. 3) and the biggie... haven't figured out how to sync the v-scrolling between the 2 controls. expandcollapse popup#include <GUIConstants.au3> ;#Include <GuiEdit.au3> $Form1 = GUICreate("Form1", 123, 176, 415, 239, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_OVERLAPPEDWINDOW, $WS_TILEDWINDOW, $WS_POPUP, $WS_POPUPWINDOW, $WS_GROUP, $WS_TABSTOP, $WS_BORDER, $WS_CLIPSIBLINGS)) $Edit_Num = GUICtrlCreateEdit("", 0, 0, 25, 165, BitOR($ES_AUTOVSCROLL,$ES_READONLY), 0); drop 'readonly' and number 1 deletes on first return GUICtrlSetData(-1, "1") GUICtrlSetBkColor(-1, 0xC0DCC0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH) $Edit_Main = GUICtrlCreateEdit("", 26, 0, 96, 175, -1, 0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM) GUICtrlCreateLabel("", 0, 164, 25, 11) GUICtrlSetBkColor(-1, 0xC0DCC0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH) GUISetState(@SW_SHOW) GUICtrlSetState($Edit_Num, $GUI_DISABLE); prevents goofinies when clicking on $Edit_Num control While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit EndSwitch If ControlCommand($Form1, "", $Edit_Num, "GetLineCount") < ControlCommand($Form1, "", $Edit_Main, "GetLineCount") Then Sleep(20) $Line = (@CRLF & (ControlCommand($Form1, "", $Edit_Num, "GetLineCount") + 1)) GUICtrlSetData($Edit_Num, $Line, "a") ElseIf ControlCommand($Form1, "", $Edit_Main, "GetLineCount") < ControlCommand($Form1, "", $Edit_Num, "GetLineCount") Then Sleep(20) $Line = Send("") GUICtrlSetData($Edit_Num, $Line) EndIf WEnd #cs _GUICtrlEdit_Scroll _GUICtrlEdit_LineScroll Scrolls the text #Include <GuiEdit.au3> _GUICtrlEdit_LineScroll($hWnd, $iHoriz, $iVert) #ce Edited December 18, 2007 by atomman Link to comment Share on other sites More sharing options...
martin Posted December 18, 2007 Share Posted December 18, 2007 i probably re-invented the wheel here, but i couldn't find anything i liked. besides, it was fun! 2 edit controls, side by side. 1st holds numbers (read only, disabled), second is regular edit control with scroll bars. GUI is resizable. problems: 1) adding lines works fine, but when backspacing in the main edit ctrl, script has to re-draw all the numbers. sure, can drop the 20ms sleep, but this doesn't solve the core problem. 2) using the UP arrow in the main edit ctrl adjusts the line numbers and this is not what i want. 3) and the biggie... haven't figured out how to sync the v-scrolling between the 2 controls. expandcollapse popup#include <GUIConstants.au3> ;#Include <GuiEdit.au3> $Form1 = GUICreate("Form1", 123, 176, 415, 239, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_OVERLAPPEDWINDOW, $WS_TILEDWINDOW, $WS_POPUP, $WS_POPUPWINDOW, $WS_GROUP, $WS_TABSTOP, $WS_BORDER, $WS_CLIPSIBLINGS)) $Edit_Num = GUICtrlCreateEdit("", 0, 0, 25, 165, BitOR($ES_AUTOVSCROLL,$ES_READONLY), 0); drop 'readonly' and number 1 deletes on first return GUICtrlSetData(-1, "1") GUICtrlSetBkColor(-1, 0xC0DCC0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH) $Edit_Main = GUICtrlCreateEdit("", 26, 0, 96, 175, -1, 0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM) GUICtrlCreateLabel("", 0, 164, 25, 11) GUICtrlSetBkColor(-1, 0xC0DCC0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH) GUISetState(@SW_SHOW) GUICtrlSetState($Edit_Num, $GUI_DISABLE); prevents goofinies when clicking on $Edit_Num control While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit EndSwitch If ControlCommand($Form1, "", $Edit_Num, "GetLineCount") < ControlCommand($Form1, "", $Edit_Main, "GetLineCount") Then Sleep(20) $Line = (@CRLF & (ControlCommand($Form1, "", $Edit_Num, "GetLineCount") + 1)) GUICtrlSetData($Edit_Num, $Line, "a") ElseIf ControlCommand($Form1, "", $Edit_Main, "GetLineCount") < ControlCommand($Form1, "", $Edit_Num, "GetLineCount") Then Sleep(20) $Line = Send("") GUICtrlSetData($Edit_Num, $Line) EndIf WEnd #cs _GUICtrlEdit_Scroll _GUICtrlEdit_LineScroll Scrolls the text #Include <GuiEdit.au3> _GUICtrlEdit_LineScroll($hWnd, $iHoriz, $iVert) #ce Maybe this expandcollapse popup#include <GUIConstants.au3> #Include <GuiEdit.au3> $Form1 = GUICreate("Form1", 123, 176, 415, 239, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_OVERLAPPEDWINDOW, $WS_TILEDWINDOW, $WS_POPUP, $WS_POPUPWINDOW, $WS_GROUP, $WS_TABSTOP, $WS_BORDER, $WS_CLIPSIBLINGS)) $Edit_Num = GUICtrlCreateEdit("", 0, 0, 25, 165, BitOR($ES_AUTOVSCROLL, $ES_READONLY), 0) GUICtrlSetData(-1, "1") GUICtrlSetBkColor(-1, 0xC0DCC0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH) $Edit_Main = GUICtrlCreateEdit("", 26, 0, 96, 175, -1, 0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM) GUICtrlCreateLabel("", 0, 164, 25, 11) GUICtrlSetBkColor(-1, 0xC0DCC0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH) GUISetState(@SW_SHOW) GUICtrlSetState($Edit_Num, $GUI_DISABLE); prevents goofinies when clicking on $Edit_Num control While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit EndSwitch While _GUICtrlEdit_GetLineCount ($Edit_Main) > _GUICtrlEdit_GetLineCount ($Edit_Num) _GUICtrlEdit_AppendText ($Edit_Num, @CRLF & _GUICtrlEdit_GetLineCount ($Edit_Num) + 1) WEnd If _GUICtrlEdit_GetLineCount ($Edit_Main) < _GUICtrlEdit_GetLineCount ($Edit_Num) Then $text = GUICtrlRead($Edit_Num) For $n = _GUICtrlEdit_GetLineCount ($Edit_Main) To _GUICtrlEdit_GetLineCount ($Edit_Num) $text = StringReplace($text, @CRLF & $n, '') Next GUICtrlSetData($Edit_Num, $text) EndIf While _GUICtrlEdit_GetFirstVisibleLine ($Edit_Main) > _GUICtrlEdit_GetFirstVisibleLine ($Edit_Num) _GUICtrlEdit_Scroll ($Edit_Num, $SB_LINEDOWN) WEnd While _GUICtrlEdit_GetFirstVisibleLine ($Edit_Main) < _GUICtrlEdit_GetFirstVisibleLine ($Edit_Num) _GUICtrlEdit_Scroll ($Edit_Num, $SB_LINEUP) WEnd #cs If ControlCommand($Form1, "", $Edit_Num, "GetLineCount") < ControlCommand($Form1, "", $Edit_Main, "GetLineCount") Then Sleep(20) $Line = (@CRLF & (ControlCommand($Form1, "", $Edit_Num, "GetLineCount") + 1)) GUICtrlSetData($Edit_Num, $Line, "a") ElseIf ControlCommand($Form1, "", $Edit_Main, "GetLineCount") < ControlCommand($Form1, "", $Edit_Num, "GetLineCount") Then Sleep(20) $Line = Send("") GUICtrlSetData($Edit_Num, $Line) EndIf #ce WEnd #cs _GUICtrlEdit_Scroll _GUICtrlEdit_LineScroll Scrolls the text #Include <GuiEdit.au3> _GUICtrlEdit_LineScroll($hWnd, $iHoriz, $iVert) #ce 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...
atomman Posted December 18, 2007 Author Share Posted December 18, 2007 (edited) works very well! thanks Martin. i'm using SciTE 1.74. if you have the same, place the caret after 'EndSwitch', hit return and see what happens. i get a tab between 'EndSwitc' and 'h', and then the new line. UPDATE: if i change the language to text, works fine. back to AU3, same problem. Edited December 18, 2007 by atomman Link to comment Share on other sites More sharing options...
atomman Posted December 28, 2007 Author Share Posted December 28, 2007 Wondering if anyone can improve on this. I provided the code, then Martin modified it, and now i'm tinkering with it again. the goal is 2 edit controls with synchronized scrolling and line numbering. Issues: i don't really like using AdLib here, but i don't know how else to do it while keeping CPU usage low. If you do this stuff using If/EndIf, While/WEnd, etc, inside the loop, then CPU will always be high (~8%) as long as the GUI is focused and you move the mouse around (on or off the GUI). i don't know what causes that. if you change the AdLibEnable() time, different things will happen. sometimes CPU will go to 50% only when holding down BACKSPACE for 40+ lines, other times when holding ENTER for 40+ lines (may have to do with scrolling). it's just not a very pretty solution to what i'm trying to do IMO, but it *almost* works. expandcollapse popup#include <GUIConstants.au3> #Include <GuiEdit.au3> #Include <Misc.au3> $Form1 = GUICreate("Form1", 123, 176, 415, 239, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_OVERLAPPEDWINDOW, $WS_TILEDWINDOW, $WS_POPUP, $WS_POPUPWINDOW, $WS_GROUP, $WS_TABSTOP, $WS_BORDER, $WS_CLIPSIBLINGS)) $Edit_Num = GUICtrlCreateEdit("", 0, 0, 25, 165, BitOR($ES_AUTOVSCROLL, $ES_READONLY), 0) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetData(-1, "1") GUICtrlSetBkColor(-1, 0xC0DCC0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH) $Edit_Main = GUICtrlCreateEdit("", 26, 0, 96, 175, -1, 0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM) GUICtrlCreateLabel("", 0, 164, 25, 11) GUICtrlSetBkColor(-1, 0xC0DCC0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH) GUISetState(@SW_SHOW) AdlibEnable("_LineNum", 111) ;AdlibEnable("_ScrollSync", 12) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _LineNum() ; line numbering While _GUICtrlEdit_GetLineCount ($Edit_Main) > _GUICtrlEdit_GetLineCount ($Edit_Num) _GUICtrlEdit_AppendText ($Edit_Num, @CRLF & _GUICtrlEdit_GetLineCount ($Edit_Num) + 1) ;Sleep(1) WEnd If _GUICtrlEdit_GetLineCount ($Edit_Main) < _GUICtrlEdit_GetLineCount ($Edit_Num) Then $text = GUICtrlRead($Edit_Num) For $n = _GUICtrlEdit_GetLineCount ($Edit_Main) To _GUICtrlEdit_GetLineCount ($Edit_Num) $text = StringReplace($text, @CRLF & $n, '') ;Sleep(1) Next GUICtrlSetData($Edit_Num, $text) EndIf ;EndFunc ;Func _ScrollSync() ; syncronized scrolling While _GUICtrlEdit_GetFirstVisibleLine ($Edit_Main) > _GUICtrlEdit_GetFirstVisibleLine ($Edit_Num) _GUICtrlEdit_Scroll ($Edit_Num, $SB_LINEDOWN) ;Sleep(1) WEnd While _GUICtrlEdit_GetFirstVisibleLine ($Edit_Main) < _GUICtrlEdit_GetFirstVisibleLine ($Edit_Num) _GUICtrlEdit_Scroll ($Edit_Num, $SB_LINEUP) ;Sleep(1) WEnd EndFunc Link to comment Share on other sites More sharing options...
Bowmore Posted December 28, 2007 Share Posted December 28, 2007 Wondering if anyone can improve on this. I provided the code, then Martin modified it, and now i'm tinkering with it again. the goal is 2 edit controls with synchronized scrolling and line numbering. Issues: i don't really like using AdLib here, but i don't know how else to do it while keeping CPU usage low. If you do this stuff using If/EndIf, While/WEnd, etc, inside the loop, then CPU will always be high (~8%) as long as the GUI is focused and you move the mouse around (on or off the GUI). i don't know what causes that. if you change the AdLibEnable() time, different things will happen. sometimes CPU will go to 50% only when holding down BACKSPACE for 40+ lines, other times when holding ENTER for 40+ lines (may have to do with scrolling). it's just not a very pretty solution to what i'm trying to do IMO, but it *almost* works. I've rewritten your _lineNum() function to be more CPU friendly. On my PC it barely registers on the performance tab in Task Manager. There may be scope for a little more performance if you want to have a go. If you don't want to use adlib() then I think you will have to register your own message handler as AUtoIt only processes lost focus messages for edit controls. Func _LineNum() ; line numbering Local $iCount = _GUICtrlEdit_GetLineCount ($Edit_Main) If $iCount <> $g_iMainLineCount Then $g_iMainLineCount = $iCount Local $iNumCount = _GUICtrlEdit_GetLineCount ($Edit_Num) If $g_iMainLineCount > $iNumCount Then For $i = $iNumCount + 1 To $g_iMainLineCount _GUICtrlEdit_AppendText ($Edit_Num, @CRLF & $i) Next ElseIf $g_iMainLineCount < $iNumCount Then $text = GUICtrlRead($Edit_Num) StringRegExpReplace($text,"(\r\n[0-9]*){" & $g_iMainLineCount - $iNumCount & "}^", "") GUICtrlSetData($Edit_Num, $text) EndIf EndIf Local $iFirstVisMain = _GUICtrlEdit_GetFirstVisibleLine ($Edit_Main) Local $iFirstVisNum = _GUICtrlEdit_GetFirstVisibleLine ($Edit_Num) If $iFirstVisMain <> $iFirstVisNum Then _GUICtrlEdit_LineScroll($Edit_Num, 0, $iFirstVisMain - $iFirstVisNum) EndIf EndFunc "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook Link to comment Share on other sites More sharing options...
atomman Posted December 28, 2007 Author Share Posted December 28, 2007 Bowmore - this is looking good. The script doesn't stall and CPU is always low/zero, but it's on the far edge of what i'm able to understand at this point (nOOb). Maybe you can help me out... When i ran it, i see '$g_iMainLineCount' was not declared. At first glance, i thought that was to be ($Edit_Main), but i see you already had that declared and i didn't see where it needs to be re-declared, so i just made it 'Local $g_iMainLineCount' at the top of the func and left it at that. This allows the script to run, but i'm still not sure what '$g_iMainLineCount' actually is. Then we have: If $iCount <> $g_iMainLineCount Then $g_iMainLineCount = $iCount This locks up my little brain because it says to me; if 'a' does not equal 'b' then 'b=a' which i see as being the same as; if 'a' does not equal 'b' then 'a=b'. My thinking is, if they don't equal, then why would you say they do? I'm wrong, i just don't why i'm wrong. I also tried dumping those 2 lines and the script *seems* to work the same (see below). The only problem i see is that it doesn't work backwards, meaning the line numbers, once written, are never removed with the 'StringRegExpReplace'. What happens when you BACKSPACE is that $Edit_Num keeps redrawing endlessly. The scrolling is cool! Basically 2 lines of code. Didn't know it could be done that efficiently. Here's what i have... expandcollapse popup#include <GUIConstants.au3> #Include <GuiEdit.au3> #Include <Misc.au3> $Form1 = GUICreate("Form1", 123, 176, 415, 239, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_OVERLAPPEDWINDOW, $WS_TILEDWINDOW, $WS_POPUP, $WS_POPUPWINDOW, $WS_GROUP, $WS_TABSTOP, $WS_BORDER, $WS_CLIPSIBLINGS)) $Edit_Num = GUICtrlCreateEdit("", 0, 0, 25, 165, BitOR($ES_AUTOVSCROLL, $ES_READONLY), 0) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetData(-1, "1") GUICtrlSetBkColor(-1, 0xC0DCC0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH) $Edit_Main = GUICtrlCreateEdit("", 26, 0, 96, 175, -1, 0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM) GUICtrlCreateLabel("", 0, 164, 25, 11) GUICtrlSetBkColor(-1, 0xC0DCC0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH) GUISetState(@SW_SHOW) AdlibEnable("_LineNum", 2) ;AdlibEnable("_ScrollSync", 12) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _LineNum() ; line numbering ;Local $iCount = _GUICtrlEdit_GetLineCount ($Edit_Main) Local $g_iMainLineCount = _GUICtrlEdit_GetLineCount ($Edit_Main) Local $iNumCount = _GUICtrlEdit_GetLineCount ($Edit_Num) ;If $iCount <> $g_iMainLineCount Then ;$g_iMainLineCount = $iCount If $g_iMainLineCount > $iNumCount Then For $i = $iNumCount + 1 To $g_iMainLineCount _GUICtrlEdit_AppendText($Edit_Num, @CRLF & $i) Next ElseIf $g_iMainLineCount < $iNumCount Then $text = GUICtrlRead($Edit_Num) StringRegExpReplace($text,"(\r\n[0-9]*){" & $g_iMainLineCount - $iNumCount & "}^", "") GUICtrlSetData($Edit_Num, $text) EndIf ;EndIf ; sync scrolling Local $iFirstVisMain = _GUICtrlEdit_GetFirstVisibleLine ($Edit_Main) Local $iFirstVisNum = _GUICtrlEdit_GetFirstVisibleLine ($Edit_Num) If $iFirstVisMain <> $iFirstVisNum Then _GUICtrlEdit_LineScroll($Edit_Num, 0, $iFirstVisMain - $iFirstVisNum) EndIf EndFunc Link to comment Share on other sites More sharing options...
atomman Posted December 28, 2007 Author Share Posted December 28, 2007 this is working so far... expandcollapse popup#include <GUIConstants.au3> #Include <GuiEdit.au3> #Include <Misc.au3> $Form1 = GUICreate("Form1", 123, 176, 415, 239, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_OVERLAPPEDWINDOW, $WS_TILEDWINDOW, $WS_POPUP, $WS_POPUPWINDOW, $WS_GROUP, $WS_TABSTOP, $WS_BORDER, $WS_CLIPSIBLINGS)) $Edit_Num = GUICtrlCreateEdit("", 0, 0, 25, 165, BitOR($ES_AUTOVSCROLL, $ES_READONLY), 0) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetData(-1, "1") GUICtrlSetBkColor(-1, 0xC0DCC0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH) $Edit_Main = GUICtrlCreateEdit("", 26, 0, 96, 175, -1, 0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM) GUICtrlCreateLabel("", 0, 164, 25, 11) GUICtrlSetBkColor(-1, 0xC0DCC0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH) GUISetState(@SW_SHOW) Opt("TrayIconDebug", 1) AdlibEnable("_LineNum", 2) ;AdlibEnable("_ScrollSync", 12) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd ;#cs Func _LineNum() ; line numbering ;Local $iCount = _GUICtrlEdit_GetLineCount($Edit_Main) ;Local $g_iMainLineCount ;= _GUICtrlEdit_GetLineCount ($Edit_Main) ;Local $iNumCount = _GUICtrlEdit_GetLineCount($Edit_Num) ;If _GUICtrlEdit_GetLineCount($Edit_Main) <> _GUICtrlEdit_GetLineCount($Edit_Num) Then ;_GUICtrlEdit_GetLineCount($Edit_Num) = _GUICtrlEdit_GetLineCount($Edit_Main) If _GUICtrlEdit_GetLineCount($Edit_Main) > _GUICtrlEdit_GetLineCount($Edit_Num) Then For $i = _GUICtrlEdit_GetLineCount($Edit_Num) + 1 To _GUICtrlEdit_GetLineCount($Edit_Main) _GUICtrlEdit_AppendText($Edit_Num, @CRLF & $i) Next #cs ElseIf _GUICtrlEdit_GetLineCount($Edit_Main) < _GUICtrlEdit_GetLineCount($Edit_Num) Then $text = GUICtrlRead($Edit_Num) StringRegExpReplace($text,"(\r\n[0-9]*){" & _GUICtrlEdit_GetLineCount($Edit_Main) - _GUICtrlEdit_GetLineCount($Edit_Num) & "}^", "") GUICtrlSetData($Edit_Num, $text) EndIf #ce ElseIf _GUICtrlEdit_GetLineCount($Edit_Main) < _GUICtrlEdit_GetLineCount($Edit_Num) Then $text = GUICtrlRead($Edit_Num) For $n = _GUICtrlEdit_GetLineCount($Edit_Main) To _GUICtrlEdit_GetLineCount($Edit_Num) $text = StringReplace($text, @CRLF & $n, '') ;Sleep(1) Next GUICtrlSetData($Edit_Num, $text) EndIf ; sync scrolling Local $iFirstVisMain = _GUICtrlEdit_GetFirstVisibleLine($Edit_Main) Local $iFirstVisNum = _GUICtrlEdit_GetFirstVisibleLine($Edit_Num) If $iFirstVisMain <> $iFirstVisNum Then _GUICtrlEdit_LineScroll($Edit_Num, 0, $iFirstVisMain - $iFirstVisNum) EndIf EndFunc ;==>_LineNum Link to comment Share on other sites More sharing options...
martin Posted December 28, 2007 Share Posted December 28, 2007 Bowmore - this is looking good. The script doesn't stall and CPU is always low/zero, but it's on the far edge of what i'm able to understand at this point (nOOb). Maybe you can help me out... When i ran it, i see '$g_iMainLineCount' was not declared. At first glance, i thought that was to be ($Edit_Main), but i see you already had that declared and i didn't see where it needs to be re-declared, so i just made it 'Local $g_iMainLineCount' at the top of the func and left it at that. This allows the script to run, but i'm still not sure what '$g_iMainLineCount' actually is. Then we have: If $iCount <> $g_iMainLineCount Then $g_iMainLineCount = $iCount This locks up my little brain because it says to me; if 'a' does not equal 'b' then 'b=a' which i see as being the same as; if 'a' does not equal 'b' then 'a=b'. My thinking is, if they don't equal, then why would you say they do? I'm wrong, i just don't why i'm wrong. I also tried dumping those 2 lines and the script *seems* to work the same (see below). The only problem i see is that it doesn't work backwards, meaning the line numbers, once written, are never removed with the 'StringRegExpReplace'. What happens when you BACKSPACE is that $Edit_Num keeps redrawing endlessly. The scrolling is cool! Basically 2 lines of code. Didn't know it could be done that efficiently. Here's what i have... expandcollapse popup#include <GUIConstants.au3> #Include <GuiEdit.au3> #Include <Misc.au3> $Form1 = GUICreate("Form1", 123, 176, 415, 239, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_OVERLAPPEDWINDOW, $WS_TILEDWINDOW, $WS_POPUP, $WS_POPUPWINDOW, $WS_GROUP, $WS_TABSTOP, $WS_BORDER, $WS_CLIPSIBLINGS)) $Edit_Num = GUICtrlCreateEdit("", 0, 0, 25, 165, BitOR($ES_AUTOVSCROLL, $ES_READONLY), 0) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetData(-1, "1") GUICtrlSetBkColor(-1, 0xC0DCC0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH) $Edit_Main = GUICtrlCreateEdit("", 26, 0, 96, 175, -1, 0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM) GUICtrlCreateLabel("", 0, 164, 25, 11) GUICtrlSetBkColor(-1, 0xC0DCC0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH) GUISetState(@SW_SHOW) AdlibEnable("_LineNum", 2) ;AdlibEnable("_ScrollSync", 12) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _LineNum() ; line numbering ;Local $iCount = _GUICtrlEdit_GetLineCount ($Edit_Main) Local $g_iMainLineCount = _GUICtrlEdit_GetLineCount ($Edit_Main) Local $iNumCount = _GUICtrlEdit_GetLineCount ($Edit_Num) ;If $iCount <> $g_iMainLineCount Then ;$g_iMainLineCount = $iCount If $g_iMainLineCount > $iNumCount Then For $i = $iNumCount + 1 To $g_iMainLineCount _GUICtrlEdit_AppendText($Edit_Num, @CRLF & $i) Next ElseIf $g_iMainLineCount < $iNumCount Then $text = GUICtrlRead($Edit_Num) StringRegExpReplace($text,"(\r\n[0-9]*){" & $g_iMainLineCount - $iNumCount & "}^", "") GUICtrlSetData($Edit_Num, $text) EndIf ;EndIf ; sync scrolling Local $iFirstVisMain = _GUICtrlEdit_GetFirstVisibleLine ($Edit_Main) Local $iFirstVisNum = _GUICtrlEdit_GetFirstVisibleLine ($Edit_Num) If $iFirstVisMain <> $iFirstVisNum Then _GUICtrlEdit_LineScroll($Edit_Num, 0, $iFirstVisMain - $iFirstVisNum) EndIf EndFunc Replace StringRegExpReplace($text,"(\r\n[0-9]*){" & $g_iMainLineCount - $iNumCount & "}^", "") with $text = stringleft($text, stringinstr($text,$g_iMainLineCount)) If you don't like AdLib then you could use the $EN_CHANGE nitification. I have just made an example here which might help. 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...
therks Posted December 28, 2007 Share Posted December 28, 2007 If $iCount <> $g_iMainLineCount Then $g_iMainLineCount = $iCount This locks up my little brain because it says to me; if 'a' does not equal 'b' then 'b=a' which i see as being the same as; if 'a' does not equal 'b' then 'a=b'.Without actually looking at the fullscript, I have made an assumption on what is happening as it's a coding practice I use a lot myself. To try and break it down, I'll use two examples: Local $MouseNow While 1 $MouseNow = MouseGetPos(0) & ' x ' & MouseGetPos(1) ToolTip($MouseNow & @LF & TimerInit()) Sleep(1) WEndoÝ÷ ØÚ0ü¨º»§¶¬{¦¦W²¢íý[zØZ¶Ø^¶%¶*b±Ê'²Ö§¶®¥Öx½éðéíè§~æjب°j{L¢ë¦"¶*'«'¢×!jxu8^N)¬â¶+#ºËmêÞ²¨¹Æ§±ç«b·lr쵩í+©u«báȬZn(y©pØZ¶%¶*[ºØÁìç!jx"ºw!¡û-¹÷ÛjÇ¢{azö«¦å{Mú2¬xÚ0Áì(ºWgßÛgyǬ±ªâ,ÛaÇ(ËZÛ©u«b®¶sdÆö6Âb33c´Ö÷W6Tæ÷rÂb33c´Ö÷W6U&VÖVÖ&W ¥vÆR b33c´Ö÷W6Tæ÷rÒÖ÷W6TvWE÷2fײb33²b33²fײÖ÷W6TvWE÷2 bb33c´Ö÷W6Tæ÷rfÇC²fwC²b33c´Ö÷W6U&VÖVÖ&W"FVà FööÅFb33c´Ö÷W6Tæ÷rfײÄbfײFÖW$æB b33c´Ö÷W6U&VÖVÖ&W"Òb33c´Ö÷W6Tæ÷p VæD` 6ÆVW¥tVæ Now as you can see in this example, the tooltip is NOT constantly updating - only when the mouse moves. Why? It's fairly simple. We are saving the mouse position in a "remember" variable so that we can compare it to see if/when it changes. Then when it does change, we update the remember variable with the new value to prepare for another comparison. Does that help to explain it a little better? My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
therks Posted December 28, 2007 Share Posted December 28, 2007 (edited) If you don't like AdLib then you could use the $EN_CHANGE nitification. That will work for the line count (work great in fact) but not for the scrolling. The best I've been able to discern, the only message being sent during the scrolling of an edit is WM_CTLCOLOREDIT. I guess you could hook that? *Edit: Seems to work quite well actually. expandcollapse popup#include <GUIConstants.au3> #Include <GuiEdit.au3> #Include <Misc.au3> GUIRegisterMsg($WM_CTLCOLOREDIT, 'WM_CTLCOLOREDIT') $Form1 = GUICreate("Form1", 123, 176, 415, 239, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_OVERLAPPEDWINDOW, $WS_TILEDWINDOW, $WS_POPUP, $WS_POPUPWINDOW, $WS_GROUP, $WS_TABSTOP, $WS_BORDER, $WS_CLIPSIBLINGS)) $Edit_Num = GUICtrlCreateEdit("", 0, 0, 25, 165, BitOR($ES_AUTOVSCROLL, $ES_READONLY), 0) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetData(-1, "1") GUICtrlSetBkColor(-1, 0xC0DCC0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH) $Edit_Main = GUICtrlCreateEdit("", 26, 0, 96, 175, -1, 0) ConsoleWrite($Edit_Main & @CRLF) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM) GUICtrlCreateLabel("", 0, 164, 25, 11) GUICtrlSetBkColor(-1, 0xC0DCC0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH) GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func WM_CTLCOLOREDIT($hWnd, $iMsg, $iWParam, $iLParam) If $iLParam = GUICtrlGetHandle($Edit_Main) Then Local $iCount = _GUICtrlEdit_GetLineCount ($Edit_Main) Local $iNumCount = _GUICtrlEdit_GetLineCount ($Edit_Num) - 2 If $iCount <> $iNumCount Then Local $sNumContent = '' For $i = 1 To $iCount $sNumContent &= $i & @CRLF Next GUICtrlSetData($Edit_Num, $sNumContent & @CRLF) EndIf Local $iFirstVisMain = _GUICtrlEdit_GetFirstVisibleLine ($Edit_Main) Local $iFirstVisNum = _GUICtrlEdit_GetFirstVisibleLine ($Edit_Num) If $iFirstVisMain <> $iFirstVisNum Then _GUICtrlEdit_LineScroll($Edit_Num, 0, $iFirstVisMain - $iFirstVisNum) EndIf EndIf Return $GUI_RUNDEFMSG EndFunc Edited December 28, 2007 by Saunders My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
martin Posted December 28, 2007 Share Posted December 28, 2007 That will work for the line count (work great in fact) but not for the scrolling. The best I've been able to discern, the only message being sent during the scrolling of an edit is WM_CTLCOLOREDIT. I guess you could hook that?*Edit: Seems to work quite well actually.That looks like a clever idea to me, I'd never heard of WM_CTLCOLOREDIT before, but perhaps it would be more obvious to use $EN_VSCROLL which is explained here. 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...
therks Posted December 28, 2007 Share Posted December 28, 2007 I saw that, but it wouldn't work because it comes from the WM_COMMAND message which, for some reason, is not being fired off while moving the scrollbar (with the mouse). My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
martin Posted December 28, 2007 Share Posted December 28, 2007 I saw that, but it wouldn't work because it comes from the WM_COMMAND message which, for some reason, is not being fired off while moving the scrollbar (with the mouse).Ah I see, I hadn't understood that. Seems a bit strange but not much we can do about that. Thanks Saunders. 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...
atomman Posted December 28, 2007 Author Share Posted December 28, 2007 you guys are sharp! Saunders - the last code you posted is looking very good! CPU rises to ~25% *only* if holding ENTER and after ~40+ lines. Same with BACKSPACE. That is quite acceptable to me since it's a condition that should never arise, but it's nice to know that the script won't bomb if it does You may not have realized it, but your code fixed another problem i found which was the line numbers getting all screwed up if the script was run with a bunch of text already in the main edit control. It would re-write all/most of the line numbers like... 0123 4567 8901 2345 etc... I added 1 line of code to cause a 3rd edit control to follow the others. Done! This is going too good now I thank you ALL *very* much! I've been working on this with my very limited ability for way longer than i wanted/expected to. Link to comment Share on other sites More sharing options...
Bowmore Posted December 29, 2007 Share Posted December 29, 2007 (edited) Bowmore - this is looking good. The script doesn't stall and CPU is always low/zero, but it's on the far edge of what i'm able to understand at this point (nOOb). Maybe you can help me out... When i ran it, i see '$g_iMainLineCount' was not declared. At first glance, i thought that was to be ($Edit_Main), but i see you already had that declared and i didn't see where it needs to be re-declared, so i just made it 'Local $g_iMainLineCount' at the top of the func and left it at that. This allows the script to run, but i'm still not sure what '$g_iMainLineCount' actually is.Sorry I should have posted my complete script. '$g_iMainLineCount' is a global variable used to save the line count between calls to _LineNum() so the we can check if a line has been added or deleted without having to run the complete function. Then we have: If $iCount <> $g_iMainLineCount Then $g_iMainLineCount = $iCount This locks up my little brain because it says to me; if 'a' does not equal 'b' then 'b=a' which i see as being the same as; if 'a' does not equal 'b' then 'a=b'. My thinking is, if they don't equal, then why would you say they do? I'm wrong, i just don't why i'm wrong. I also tried dumping those 2 lines and the script *seems* to work the same (see below).This simple checks if the count has changed and if it has updates the global variable with the new value The only problem i see is that it doesn't work backwards, meaning the line numbers, once written, are never removed with the 'StringRegExpReplace'. What happens when you BACKSPACE is that $Edit_Num keeps redrawing endlessly.The 'StringRegExpReplace' was not working as I had intended so replaced with a simple loop, with $g_iMainLineCount declared as a global variable at the top of the script this should work OK. The scrolling is cool! Basically 2 lines of code. Didn't know it could be done that efficiently. Complete script expandcollapse popup#include <GUIConstants.au3> #Include <GuiEdit.au3> #Include <Misc.au3> Global $g_iMainLineCount = 0 ; Keep a global count so we can check if it has changed $Form1 = GUICreate("Form1", 123, 176, 415, 239, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_OVERLAPPEDWINDOW, $WS_TILEDWINDOW, $WS_POPUP, $WS_POPUPWINDOW, $WS_GROUP, $WS_TABSTOP, $WS_BORDER, $WS_CLIPSIBLINGS)) $Edit_Num = GUICtrlCreateEdit("", 0, 0, 25, 165, BitOR($ES_AUTOVSCROLL, $ES_READONLY), 0) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetData(-1, "1") GUICtrlSetBkColor(-1, 0xC0DCC0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH) $Edit_Main = GUICtrlCreateEdit("", 26, 0, 96, 175, -1, 0) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $Edit_Main = ' & $Edit_Main & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM) GUICtrlCreateLabel("", 0, 164, 25, 11) GUICtrlSetBkColor(-1, 0xC0DCC0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH) GUISetState(@SW_SHOW) AdlibEnable("_LineNum", 111) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _LineNum() ; line numbering Local $iCount = _GUICtrlEdit_GetLineCount ($Edit_Main) ;Check if the number of lines has changed in $Edit_Main ;since this function was last called If $iCount <> $g_iMainLineCount Then ;save the new count to the global variable $g_iMainLineCount = $iCount Local $iNumCount = _GUICtrlEdit_GetLineCount ($Edit_Num) If $g_iMainLineCount > $iNumCount Then For $i = $iNumCount + 1 To $g_iMainLineCount _GUICtrlEdit_AppendText ($Edit_Num, @CRLF & $i) Next ElseIf $g_iMainLineCount < $iNumCount Then $text = GUICtrlRead($Edit_Num) For $i = $iNumCount To $g_iMainLineCount + 1 Step -1 $text = StringReplace($text,@CRLF & $i,"") Next GUICtrlSetData($Edit_Num, $text) EndIf EndIf Local $iFirstVisMain = _GUICtrlEdit_GetFirstVisibleLine ($Edit_Main) Local $iFirstVisNum = _GUICtrlEdit_GetFirstVisibleLine ($Edit_Num) If $iFirstVisMain <> $iFirstVisNum Then _GUICtrlEdit_LineScroll($Edit_Num, 0, $iFirstVisMain - $iFirstVisNum) EndIf EndFunc Edit to script to replace StringRegExReplace with StringReplace Edited December 29, 2007 by Bowmore mLipok 1 "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook Link to comment Share on other sites More sharing options...
mLipok Posted August 22, 2014 Share Posted August 22, 2014 Very nice script. Still works after small change: AdlibEnable >>> AdlibRegister I also make some celanup. expandcollapse popup#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 #include <GUIConstants.au3> #include <GuiEdit.au3> #include <Misc.au3> Global $g_iMainLineCount = 0 ; Keep a global count so we can check if it has changed Global $_idEdit_Num , $_idEdit_Main Example() Func Example() Local $hGui = GUICreate("Example", 123, 176, 415, 239, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_OVERLAPPEDWINDOW, $WS_TILEDWINDOW, $WS_POPUP, $WS_POPUPWINDOW, $WS_GROUP, $WS_TABSTOP, $WS_BORDER, $WS_CLIPSIBLINGS)) #forceref $hGui $_idEdit_Num = GUICtrlCreateEdit("", 0, 0, 25, 165, BitOR($ES_AUTOVSCROLL, $ES_READONLY), 0) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetData(-1, "1") GUICtrlSetBkColor(-1, 0xC0DCC0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH) $_idEdit_Main = GUICtrlCreateEdit("", 26, 0, 96, 175, -1, 0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM) GUICtrlCreateLabel("", 0, 164, 25, 11) GUICtrlSetBkColor(-1, 0xC0DCC0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH) GUISetState(@SW_SHOW) AdlibRegister("_LineNum", 100) Local $Msg While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd EndFunc ;==>Example Func _LineNum() ; line numbering Local $iCount = _GUICtrlEdit_GetLineCount($_idEdit_Main) ;Check if the number of lines has changed in $_idEdit_Main ;since this function was last called If $iCount <> $g_iMainLineCount Then ;save the new count to the global variable $g_iMainLineCount = $iCount Local $iNumCount = _GUICtrlEdit_GetLineCount($_idEdit_Num) If $g_iMainLineCount > $iNumCount Then For $i = $iNumCount + 1 To $g_iMainLineCount _GUICtrlEdit_AppendText($_idEdit_Num, @CRLF & $i) Next ElseIf $g_iMainLineCount < $iNumCount Then Local $text = GUICtrlRead($_idEdit_Num) For $i = $iNumCount To $g_iMainLineCount + 1 Step -1 $text = StringReplace($text, @CRLF & $i, "") Next GUICtrlSetData($_idEdit_Num, $text) EndIf EndIf Local $iFirstVisMain = _GUICtrlEdit_GetFirstVisibleLine($_idEdit_Main) Local $iFirstVisNum = _GUICtrlEdit_GetFirstVisibleLine($_idEdit_Num) If $iFirstVisMain <> $iFirstVisNum Then _GUICtrlEdit_LineScroll($_idEdit_Num, 0, $iFirstVisMain - $iFirstVisNum) EndIf EndFunc ;==>_LineNum Gianni 1 Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
kylomas Posted August 22, 2014 Share Posted August 22, 2014 mLipok, What are you doing? This script is almost 7 years old. If you want to retrofit old scripts and post them they should go in the examples section, not GH&S Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
mLipok Posted August 22, 2014 Share Posted August 22, 2014 (edited) Indeed, my fault. It was better to start in the "Example Scripts" Sorry. ps. I did not intend to become a necroposter who asks questions in old topics. I noticed this thread here, thanks to @Melba23. So I corrected the script and I thought it would be worth it to put here instead of creating a new thread, which by the way has prevented the possible questions "Why is it not working?" EDIT: I would like to point out that ultimately I want to open a thread in the "Example Scripts", but after improving a few "inconveniences" in this script. Or in this case my action was the right thing ? Edited August 22, 2014 by mLipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
kylomas Posted August 23, 2014 Share Posted August 23, 2014 It's a judgment call...I would have posted in the Examples section...Given the quality of your contributions, I'm sure it was an oversight... Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill 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