Rammanan Posted November 1, 2018 Author Share Posted November 1, 2018 Hi all, Below code msgbox always show equal. Please advice. For $i = 0 To $Num $MYEditText = _GUICtrlListBox_ClickItem ($LHandle,$i ,"left") ;work fine $MyWantedText1 = ControlGetText($Handle,"",$MYEditText ) ;work fine ;MsgBox (0 , "" , $MyWantedText1) If $MyWantedText1 <> $hsfserver Then MsgBox(32,'',"equal") Else MsgBox(32,'',"Not equal") EndIf Next Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted November 1, 2018 Share Posted November 1, 2018 @Rammanan Directly from the Forum Rules: 8. Do not delete your posts, nor completely remove their content, if doing so will interrupt the flow of the thread. Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted November 1, 2018 Share Posted November 1, 2018 (edited) @Rammanan You can't use ControlGetText() in that way, since _GUICtrlListBox_ClickItem() doesn't return any value. You could use _GUICtrlListBox_SetSel() to select your item(s) in your ListBox, and immediately after use _GUICtrlListBox_GetSelItemsText() to get the text of the selected item(s). Try it, and let us know Edited November 1, 2018 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Rammanan Posted November 1, 2018 Author Share Posted November 1, 2018 @FrancescoDiMuro FYI i'm not get value from listbox box because the return from listbox is in japanes or somthing. So i get value from editbox. So above code will select row and get value from edit box.(Work fine). Problem is below code always go for equal. $MyWantedText1 is value that i already have. If $MyWantedText1 <> $hsfserver Then MsgBox(32,'',"equal") Else MsgBox(32,'',"Not equal") EndIf Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted November 1, 2018 Share Posted November 1, 2018 How can you use the variable $MyEditText if, as I've already told you, _GUICtrlListBox_ClickItem() does not return anything? If you try to display $MyWantedText1 in your For...Next... loop, what do you get? Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Rammanan Posted November 1, 2018 Author Share Posted November 1, 2018 _GUICtrlListBox_ClickItem() do not return anything but once click the value will show at edit box . $MyWantedText1 will show value from editbox. Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted November 1, 2018 Share Posted November 1, 2018 @Rammanan So you need to get thr handle of that edit box. Is ControlGetText() currently getting any text that you can see? Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Rammanan Posted November 1, 2018 Author Share Posted November 1, 2018 (edited) @FrancescoDiMuro Yes can get value from row select. Edited November 1, 2018 by Rammanan Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted November 1, 2018 Share Posted November 1, 2018 @Rammanan Could you please post your full script? Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Rammanan Posted November 11, 2018 Author Share Posted November 11, 2018 (edited) Hi @FrancescoDiMuro Sorry for late reply. i just back to work. Below are the full code. Always get not equal. Please advise Local $ttlWindow = "DSD Window UserInterface (Ver 1.16.1) - ntmmm" Local $cidList = "[CLASS:ListBox; INSTANCE:1]" Local $cidEdit = "[CLASS:Edit; INSTANCE:3]" Local $LHandle = ControlGetHandle($ttlWindow, "", "[CLASS:ListBox; INSTANCE:1]") Local $Handle = ControlGetHandle($ttlWindow, "", "[CLASS:Edit; INSTANCE:3]") Local $num = _GUICtrlListBox_GetCount($LHandle) Local $NumForLines = $Num Local $boolCheck = 0; ;========================================= Local $hsfserver = "LSD_8_INCH" Local $i = 0 ;========================================= ;========================================= WinActivate("DSD Window UserInterface (Ver 1.16.1) - ntmmm") WinWaitActive("DSD Window UserInterface (Ver 1.16.1) - ntmmm") $hdlWindow = WinGetHandle($ttlWindow) $NumForLines -= $NumForLines For $i = 0 To $Num $MYEditText = _GUICtrlListBox_ClickItem ($LHandle,$i ,"left") ;work fine $MyWantedText1 = ControlGetText($Handle,"",$MYEditText ) ;work fine MsgBox (0 , "" , $MyWantedText1) If $MyWantedText1 <> $hsfserver Then MsgBox(32,'',"equal") Else MsgBox(32,'',"Not equal") EndIf Next Edited November 12, 2018 by Rammanan Link to comment Share on other sites More sharing options...
Rammanan Posted November 12, 2018 Author Share Posted November 12, 2018 Hi all, I still not solve the problem. Anyone can help on this.? Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted November 12, 2018 Share Posted November 12, 2018 @Rammanan Logically, these lines of code If $MyWantedText1 <> $hsfserver Then MsgBox(32,'',"equal") Else MsgBox(32,'',"Not equal") EndIf should be If $MyWantedText1 = $hsfserver Then MsgBox(32,'',"equal") Else MsgBox(32,'',"Not equal") EndIf ; Or If $MyWantedText1 <> $hsfserver Then MsgBox(32,'',"Not equal") Else MsgBox(32,'',"Equal") EndIf Run these lines of code and you'll see the correct result from your script Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Rammanan Posted November 12, 2018 Author Share Posted November 12, 2018 @FrancescoDiMuro still same not work correct. i think the problem on For statement.? Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted November 12, 2018 Share Posted November 12, 2018 (edited) @Rammanan ControlGetText() needs the Control ID of your edit control, so, instead of passing $MyEditText to the function, which is a "blank" variable, you should pass $cidEdit, which is the Control ID of the edit you are getting the text from. Try that and let us know Edited November 12, 2018 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Rammanan Posted November 15, 2018 Author Share Posted November 15, 2018 Hi all expert, Really thanks for you all help me to solve on this problem. Below are the final code that work fine. WinActivate("DSD Window UserInterface (Ver 1.16.1) - ntmmm") WinWaitActive("DSD Window UserInterface (Ver 1.16.1) - ntmmm") $NumForLines -= $NumForLines $hdlWindow = WinGetHandle($ttlWindow) For $i = 0 To $Num $open = FileOpen("C:\recipe.txt",1) $MYEditText = _GUICtrlListBox_ClickItem ($L Handle,$i) ;(Click ListBox) $MyWantedText1 = ControlGetText($Handle,"","");(Get recepi from editbox) $file = FileWrite($open,$MyWantedText1 & @CRLF) ;(Write test at .txt) Next Dim $aRecords If Not _FileReadToArray("C:\recipe.txt",$aRecords) Then ;(Read txt file at local c) MsgBox(4096,"Error", " Error reading log to Array error:" & @error) Exit EndIf ;$aArray = _ArrayDisplay( $aRecords, "Entries left in the array") _ArrayPop($aRecords) ;(Delete last entry at array) ;$aArray = _ArrayDisplay($aRecords, "Entries left in the array" ) $Search = _ArraySearch($aRecords, $hsfserver,0,0,0,1) ; (Search for string at array) If @error Then MsgBox(4096,"Error", "No Recipe Found At List Please Inform To Engineer") ;MsgBox(0, "", $aRecords[$Search] & 'found in row: ' & $Search) $int = ($Search) - (1) ;( - 1) ;MsgBox(32,'',$int) $loadrecipe = _GUICtrlListBox_ClickItem ($LHandle,$int) ;(select recepi) FileDelete("C:\recipe.txt") Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted November 15, 2018 Share Posted November 15, 2018 Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
caramen Posted November 15, 2018 Share Posted November 15, 2018 Cheers. Man well done you dont gived up. That’s how you learn autoIT. My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
Rammanan Posted November 15, 2018 Author Share Posted November 15, 2018 @caramen yes u correct. 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