senatin Posted August 17, 2017 Share Posted August 17, 2017 (edited) Sorry for asking simple problem I tried looking arround but I could not find the right one. My problem is that I created A GUI with GUICtrlCreateEdit then along with the script it keep on adding new lines What I wanted to happen is that when I insert new text line and it is the same as the last line, it will not insert to the field. Thank you Edited August 17, 2017 by senatin Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 17, 2017 Moderators Share Posted August 17, 2017 senatin, I would read the content of the edit, split it into an array and then compare the "to-be-added" text to the last element of that array. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
senatin Posted August 17, 2017 Author Share Posted August 17, 2017 (edited) is it a bit stressful to Ram? if so I rather not apply. my script add many lines when it run. so whenever I add lines it keep on splitting into array all the contents. Edited August 17, 2017 by senatin Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted August 17, 2017 Moderators Share Posted August 17, 2017 9 minutes ago, senatin said: is it a bit stressful to Ram? if so I rather not apply. my script add many lines when it run. so whenever I add lines it keep on splitting into array all the contents. It is a bit difficult to tell you how badly your script will tax resources without seeing the script. Post the script (or a reproducer) if you would like some further assistance, or just try the suggestion given by Melba for yourself if you are unable to post. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
senatin Posted August 17, 2017 Author Share Posted August 17, 2017 (edited) expandcollapse popup#include <WindowsConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> HotKeySet ("-", "SendNum") #Region ### START Koda GUI section ### Form=c:\users\mk's\desktop\form1.kxf $Form1 = GUICreate("Senatin", 615, 438, 178, 132) $Edit1 = GUICtrlCreateEdit("", 40, 96, 361, 257) $Input1 = GUICtrlCreateInput("20", 440, 136, 49, 21, $ES_NUMBER) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Turnoff() EndSwitch Wend Func SendNum() $num1 = GUICtrlRead($Input1) $Lasttxt = ControlGetText("", "", "Edit1") If($num1 <> $Lasttxt) then InsertText($num1) Endif EndFunc Func InsertText($text) GUICtrlSetData($Edit1, @CRLF & $text, 1) EndFunc Func Turnoff() Exit EndFunc Edited August 17, 2017 by senatin I notice shoudnt be == rather <> still not working Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 17, 2017 Moderators Share Posted August 17, 2017 senatin, As you are reading the number from a control in your own GUI, just store the last entered one and compare - like this: expandcollapse popup#include <EditConstants.au3> #include <GUIConstantsEx.au3> HotKeySet ("-", "SendNum") $Form1 = GUICreate("Senatin", 615, 438, 178, 132) $Edit1 = GUICtrlCreateEdit("", 40, 96, 361, 257) $Input1 = GUICtrlCreateInput("20", 440, 136, 49, 21, $ES_NUMBER) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Turnoff() EndSwitch Wend Func SendNum() ; Store the last added line Static Local $iLastNum = "" ; Get the new one $num1 = GUICtrlRead($Input1) ; Check for the same value If $num1 <> $iLastNum then ; Insert the new value InsertText($num1) ; Store it for later comparison $iLastNum = $num1 Endif EndFunc Func InsertText($text) GUICtrlSetData($Edit1, @CRLF & $text, 1) EndFunc Func Turnoff() Exit EndFunc M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
senatin Posted August 17, 2017 Author Share Posted August 17, 2017 Thank you sir 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