SNET2022 Posted January 20, 2022 Share Posted January 20, 2022 Hello Everyone, Hope everyone being safe and well. I'm newbie here, I'm facing an issue to get combobox list. There is a Combobox in AutoCAD, it has list of Dynamic List. so i want to get the list and then display for user selection. I found the Code on Help page, but it's displays only the Drives. Could you please help me to get rid of this. Combobox Info: >>>> Control <<<< Class: SNET$combobox Instance: 1 ClassnameNN: SNET$combobox1 Name: Advanced (Class): [CLASS:SNET$combobox; INSTANCE:1] ID: 8193 Text: >>>> Control <<<< Class: SNET$combobox Instance: 1 ClassnameNN: SNET$combobox1 Name: Advanced (Class): [CLASS:SNET$combobox; INSTANCE:1] ID: 8193 Found this code on Help Page: expandcollapse popup#include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Global $g_idMemo Example() Func Example() Local $aList, $idCombo Opt("GUIDataSeparatorChar", ",") ; set seperator char to char we want to use ; Create GUI GUICreate("ComboBox Get List", 400, 296) $idCombo = GUICtrlCreateCombo("", 2, 2, 396, 296) $g_idMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0) GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New") GUISetState(@SW_SHOW) ; Add files _GUICtrlComboBox_AddDir($idCombo, "", $DDL_DRIVES, False) ; Get List $aList = StringSplit(_GUICtrlComboBox_GetList($idCombo), ",") For $x = 1 To $aList[0] MemoWrite($aList[$x]) Next ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example ; Write a line to the memo control Func MemoWrite($sMessage) GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite Attached the Combobox, This Dynamic , so each time these list has been changed. Thanks in Advance. Link to comment Share on other sites More sharing options...
SNET2022 Posted January 20, 2022 Author Share Posted January 20, 2022 Hi Everyone, Could anyone please help me on this. Thanks, Link to comment Share on other sites More sharing options...
Danp2 Posted January 20, 2022 Share Posted January 20, 2022 This is a community supported forum. The general rule is that you should wait 24 hours before bumping a thread. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Nine Posted January 20, 2022 Share Posted January 20, 2022 The problem with your request is that it is very unclear. You ask how to get info from another app but you show no effort in doing so. Where is the code that you tried to get the content of the external combo box ? How you make sure that the other app is running ? What is the name of the app ? What is the aut3info tool saying about the window (not just the control) ? And many other questions, but I'll stop here. Make sure you clearly states your request if you want help... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
SNET2022 Posted January 21, 2022 Author Share Posted January 21, 2022 Hi Nine, Thanks for your reply, The App is running on Background, and the App Name is AutoCAD 2018, Please find the Info of the Combobox. Here is the code I tried, expandcollapse popup#include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Global $g_idMemo Example() Opt("WinTitleMatchMode", 2) WinActivate("Autodesk AutoCAD Map 3D 2018") sleep(400) WinWait("Autodesk AutoCAD Map 3D 2018") sleep(400) Opt("WinTitleMatchMode", 2) WinWait("Add port mapping for ") sleep(500) WinActivate("Add port mapping for ") sleep(500) $hCombo =ControlGetHandle("Add port mapping for", "", "[CLASS:SNET$combobox; INSTANCE:4]") Func Example() Local $aList, $idCombo Opt("GUIDataSeparatorChar", ",") ; set seperator char to char we want to use ; Create GUI GUICreate("ComboBox Get List", 400, 296) $idCombo = GUICtrlCreateCombo("", 2, 2, 396, 296) $g_idMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0) GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New") GUISetState(@SW_SHOW) ; Add files ; _GUICtrlComboBox_AddDir($idCombo, "", $DDL_DRIVES, False) _GUICtrlComboBox_AddDir($idCombo, "", $hCombo, False) ; Get List $aList = StringSplit(_GUICtrlComboBox_GetList($idCombo), ",") For $x = 1 To $aList[0] MemoWrite($aList[$x]) Next ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example ; Write a line to the memo control Func MemoWrite($sMessage) GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite Please let me know if anything. Thanks. Link to comment Share on other sites More sharing options...
Nine Posted January 21, 2022 Share Posted January 21, 2022 Well, Example function is executed BEFORE you initialize $hCombo ! Also, I cannot recommend more that you add some error handling in your code, checking for return values of the functions you call and also @error. That way you can know if the statement you just executed is successful or not. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
SNET2022 Posted January 21, 2022 Author Share Posted January 21, 2022 Yes, when i tried that i'm getting the below error, but i' don't know where i mention that Combobox info in code. _GUICtrlComboBox_AddDir($idCombo, "", $hCombo, False) _GUICtrlComboBox_AddDir($idCombo, "", ^ ERROR >Exit code: 1 Time: 1.12 Thanks Link to comment Share on other sites More sharing options...
Nine Posted January 21, 2022 Share Posted January 21, 2022 41 minutes ago, SNET2022 said: the below error Yep, already told you why. Do you speak english ? Do you have problem understanding what it is being told to you ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
SNET2022 Posted January 21, 2022 Author Share Posted January 21, 2022 Hi, sorry...i'm not good in english. Thanks Link to comment Share on other sites More sharing options...
Nine Posted January 21, 2022 Share Posted January 21, 2022 OK, try this from Scite and report full console here : expandcollapse popup#include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Global $g_idMemo, $hCombo Local $vResult Opt("WinTitleMatchMode", 2) $vResult = WinActivate("Autodesk AutoCAD Map 3D 2018") ConsoleWrite($vResult & "/" & @error & @CRLF) $vResult = WinWait("Autodesk AutoCAD Map 3D 2018") ConsoleWrite($vResult & "/" & @error & @CRLF) $vResult = WinWait("Add port mapping for") ConsoleWrite($vResult & "/" & @error & @CRLF) $vResult = WinActivate("Add port mapping for") ConsoleWrite($vResult & "/" & @error & @CRLF) $hCombo = ControlGetHandle("Add port mapping for", "", "[CLASS:SNET$combobox; INSTANCE:4]") ConsoleWrite($hCombo & "/" & @error & @CRLF) Local $iCount = _GUICtrlComboBox_GetCount($hCombo) If $iCount <= 0 Then Exit ConsoleWrite("unable to read combo" & @CRLF) Global $sList = _GUICtrlComboBox_GetList($hCombo) ConsoleWrite($sList & @CRLF) Example() Func Example() Local $aList, $idCombo ;Opt("GUIDataSeparatorChar", ",") ; set seperator char to char we want to use ; Create GUI GUICreate("ComboBox Get List", 400, 296) $idCombo = GUICtrlCreateCombo("", 2, 2, 396, 296) $g_idMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0) GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New") GUISetState(@SW_SHOW) GUICtrlSetData($idCombo, $sList) $aList = StringSplit(_GUICtrlComboBox_GetList($idCombo), "|") For $x = 1 To $aList[0] MemoWrite($aList[$x]) Next ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example ; Write a line to the memo control Func MemoWrite($sMessage) ConsoleWrite($sMessage & @CRLF) GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite Please study the code carefully. I added some error handling like I told you to do. Report full console here, so we can understand what is going on... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
SNET2022 Posted January 24, 2022 Author Share Posted January 24, 2022 (edited) Hello Nine, Thank you so much, It's getting the list of items from the Combobox and shows in new drop down. but i can't able to select the Item in that new dropdown. Here is the console output, 0x0004081A/0 0x0004081A/0 0x00040AE4/0 0x00040AE4/0 0x00040AFA/0 72FiberBypass|72FiberFeeder|DEFECTIVESPLTRPORTS2092A|FDHDistribution1432|FDHDistribution433864|SPLTR1|SPLTR2|SPLTR3|SPLTR4|SPLTR5|SPLTR6|SPLTR7|SPLTR8|SPLTR9|SPLTR10 72FiberBypass 72FiberFeeder DEFECTIVESPLTRPORTS2092A FDHDistribution1432 FDHDistribution433864 SPLTR1 SPLTR2 SPLTR3 SPLTR4 SPLTR5 SPLTR6 SPLTR7 SPLTR8 SPLTR9 SPLTR10 New drop down, created by Autoit. Thank you once again. Edited January 24, 2022 by SNET2022 Link to comment Share on other sites More sharing options...
ad777 Posted January 24, 2022 Share Posted January 24, 2022 SNET You can select item using either: _GUICtrlListBox_SelectString($g_idMemo,"FDHDistribution433864") or _GUICtrlListBox_SetCurSel ($g_idMemo, 0);select item at 0 position to get item use: _GUICtrlListBox_GetText($g_idMemo,_GUICtrlListBox_GetCurSel($g_idMemo)) iam ِAutoit programmer. best thing in life is to use your Brain to Achieve everything you want. Link to comment Share on other sites More sharing options...
Nine Posted January 24, 2022 Share Posted January 24, 2022 1 hour ago, SNET2022 said: but i can't able to select the Item in that new dropdown What do you mean ? Be more precise please. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
SNET2022 Posted January 24, 2022 Author Share Posted January 24, 2022 Hello Nine, After fetching the Items into New dropdown window, i need to select any one of the item, that item (Text) need to reflect again in that combo box. ("Add port mapping for", "", "[CLASS:SNET$combobox; INSTANCE:4]") Link to comment Share on other sites More sharing options...
Nine Posted January 24, 2022 Share Posted January 24, 2022 Try this : .... Global $sList = _GUICtrlComboBox_GetList($hCombo) ConsoleWrite($sList & @CRLF) Global $sCurrent = _GUICtrlComboBox_GetEditText($hCombo) ConsoleWrite($sCurrent & "/" & @error & @CRLF) .... GUICtrlSetData($idCombo, $sList, $sCurrent) .... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
ad777 Posted January 24, 2022 Share Posted January 24, 2022 Snet you ment like this: Local $STRING = _GUICtrlListBox_GetText($g_idMemo,_GUICtrlListBox_GetCurSel($g_idMemo)) ControlCommand("Add port mapping for", "", "SNET$combobox1", "SelectString", $STRING) iam ِAutoit programmer. best thing in life is to use your Brain to Achieve everything you want. Link to comment Share on other sites More sharing options...
Nine Posted January 24, 2022 Share Posted January 24, 2022 Or is it this ? expandcollapse popup#include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Global $g_idMemo, $hCombo Local $vResult Opt("WinTitleMatchMode", 2) $vResult = WinActivate("Autodesk AutoCAD Map 3D 2018") ConsoleWrite($vResult & "/" & @error & @CRLF) $vResult = WinWait("Autodesk AutoCAD Map 3D 2018") ConsoleWrite($vResult & "/" & @error & @CRLF) $vResult = WinWait("Add port mapping for") ConsoleWrite($vResult & "/" & @error & @CRLF) $vResult = WinActivate("Add port mapping for") ConsoleWrite($vResult & "/" & @error & @CRLF) $hCombo = ControlGetHandle("Add port mapping for", "", "[CLASS:SNET$combobox; INSTANCE:4]") ConsoleWrite($hCombo & "/" & @error & @CRLF) Local $iCount = _GUICtrlComboBox_GetCount($hCombo) If $iCount <= 0 Then Exit ConsoleWrite("unable to read combo" & @CRLF) Global $sList = _GUICtrlComboBox_GetList($hCombo) ConsoleWrite($sList & @CRLF) Global $sCurrent = _GUICtrlComboBox_GetEditText($hCombo) ConsoleWrite($sCurrent & "/" & @error & @CRLF) Example() Func Example() Local $aList, $idCombo ;Opt("GUIDataSeparatorChar", ",") ; set seperator char to char we want to use ; Create GUI GUICreate("ComboBox Get List", 400, 296) $idCombo = GUICtrlCreateCombo("", 2, 2, 396, 296) $g_idMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0) GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New") GUISetState(@SW_SHOW) GUICtrlSetData($idCombo, $sList, $sCurrent) $aList = StringSplit(_GUICtrlComboBox_GetList($idCombo), "|") For $x = 1 To $aList[0] MemoWrite($aList[$x]) Next While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $idCombo ControlCommand("Add port mapping for", "", "[CLASS:SNET$combobox; INSTANCE:4]", "SelectString", GUICtrlRead($idCombo)) EndSwitch WEnd EndFunc ;==>Example ; Write a line to the memo control Func MemoWrite($sMessage) ConsoleWrite($sMessage & @CRLF) GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
SNET2022 Posted January 24, 2022 Author Share Posted January 24, 2022 Hi, I just have added a button to select, and tried it. But i can select from dropdown, but that Text not reflecting in that Combobox (in AutoCAD application. I did some changes on this code. Func Example() Local $aList, $idCombo ;Opt("GUIDataSeparatorChar", ",") ; set seperator char to char we want to use ; Create GUI GUICreate("ComboBox Get List", 400, 296) $idCombo = GUICtrlCreateCombo("", 2, 2, 396, 296) $g_idMemo = GUICtrlCreateEdit("", 2, 32, 300, 266, 0) GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New") GUISetState(@SW_SHOW) $Button_1 = GUICtrlCreateButton("SELECT", 310,50, 80, 30) GUICtrlSetData($idCombo, $sList, $sCurrent) $aList = StringSplit(_GUICtrlComboBox_GetList($idCombo), "|") For $x = 1 To $aList[0] MemoWrite($aList[$x]) Next While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit ; Case $idCombo Case $Button_1 ; ControlCommand("Add port mapping for", "", "[CLASS:SNET$combobox; INSTANCE:4]", "SelectString", GUICtrlRead($idCombo)) $CBBox3=GUICtrlRead($idCombo) EndSwitch WEnd EndFunc ;==>Example $hCombo = ControlGetHandle("Add port mapping for", "", "[CLASS:SNET$combobox; INSTANCE:4]") _GUICtrlComboBox_SelectString($hCombo,$CBBox3) ; Write a line to the memo control Func MemoWrite($sMessage) ConsoleWrite($sMessage & @CRLF) GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite Link to comment Share on other sites More sharing options...
Nine Posted January 24, 2022 Share Posted January 24, 2022 Do not put code in between functions. That is a terrible way to program. Replace your case with this one : Case $Button_1 $vResult = _GUICtrlComboBox_SelectString($hCombo, GUICtrlRead($idCombo)) ConsoleWrite($vResult & "/" & @error & @CRLF) “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
SNET2022 Posted January 25, 2022 Author Share Posted January 25, 2022 Hello Nine, Sorry for changing your code. Everything works fine now, but when i select SPLTR1 on Autoit combobox, SPLTR10 is updated on AutoCAD Combobox, same time, If i select SPLTR10 on Autoit combobox, SPLTR10 is updated on AutoCAD Combobox, all other SPLTR2,3,4,5...works fine. Thanks. 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