OrthodoxyUSA Posted July 17, 2008 Share Posted July 17, 2008 Hello all! (My first post here.)I am developing a fairly complex script for use with Microsoft Dynamics "Great Plains" software.I am stumped at one particular part. I hope you guys can help.The problem is, I need to confirm that the correct user is selected in a list box before proceeding.Here is what I have been attempting to use.$i="TEST5"#include <GUIConstantsEx.au3>#include <GUIListBox.au3>AutoItSetOption("wintitlematchmode", 4)AutoItSetOption("winsearchchildren", 1)WinWaitActive("Microsoft Dynamics GP - Customer Service Mgt")Sleep(2000)WinActive("User Access Setup","")ControlFocus("User Access Setup","","[CLASS:ListBox; INSTANCE:1]")ControlSend("User Access Setup","","[CLASS:ListBox; INSTANCE:1]",$i)$text = ControlCommand("User Access Setup","","[CLASS:ListBox; INSTANCE:1]","GetCurrentSelection", "")MsgBox(0, "Text read was:", $text)I expected my MsgBox to popup with "Text read was: TEST5".I have no problem using ControlSend to select "TEST5", however I have yet to be able to confirm what is selected for error control.I have tried "ControlCommand" and "ControlListview".I need to know that the correct user (TEST5 in this case) was selected before moving to the next step.I have attached a screenshot of the ListBox and the "Window Spy" as well.Many thanks to you in advance for your help!Paul Link to comment Share on other sites More sharing options...
MrCreatoR Posted July 17, 2008 Share Posted July 17, 2008 Hi and wellcome! muttleyYou can use "ListBox1" instead of [CLASS:ListBox; INSTANCE:1]... Here is an example with GUI:#include <GUIConstantsEx.au3> #include <GUIListBox.au3> GUICreate("Test", 300, 200) GUICtrlCreateList("", 20, 20) GUICtrlSetData(-1, "sa|TEST5|Test6") GUISetState() $sString = "TEST5" ControlCommand("Test", "", "ListBox1", "SelectString", $sString) $sText = ControlCommand("Test", "", "ListBox1", "GetCurrentSelection") MsgBox(0, "Text read was:", $sText)And btw, you do not need to use «wintitlematchmode» with Advanced Window Descriptions (when you use [CLASS:...]). Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
OrthodoxyUSA Posted July 17, 2008 Author Share Posted July 17, 2008 Hi and wellcome! muttley You can use "ListBox1" instead of [CLASS:ListBox; INSTANCE:1]... Here is an example with GUI: #include <GUIConstantsEx.au3> #include <GUIListBox.au3> GUICreate("Test", 300, 200) GUICtrlCreateList("", 20, 20) GUICtrlSetData(-1, "sa|TEST5|Test6") GUISetState() $sString = "TEST5" ControlCommand("Test", "", "ListBox1", "SelectString", $sString) $sText = ControlCommand("Test", "", "ListBox1", "GetCurrentSelection") MsgBox(0, "Text read was:", $sText) And btw, you do not need to use «wintitlematchmode» with Advanced Window Descriptions (when you use [CLASS:...]). Thanks for your reply. I don't want to create a ListBox, but rather read the selected item in the ListBox that is there. I have no doubt that AutoIt can read from a ListBox that it creates. What I'm having trouble with is verifying the current selection in the Listbox that is provided in MS Dynamics Great Plains. GetCurrentSelection returns a (0) zero no matter what is selected. Any ideas? Paul Link to comment Share on other sites More sharing options...
OrthodoxyUSA Posted July 17, 2008 Author Share Posted July 17, 2008 (edited) I tried this... #include <GUIConstantsEx.au3> #include <GUIListBox.au3> AutoItSetOption("winsearchchildren", 1) WinWaitActive("Microsoft Dynamics GP - Customer Service Mgt") Sleep(2000) WinActive("User Access Setup","") ControlFocus("User Access Setup","","ListBox1") $sString = "TEST5" ControlSend("User Access Setup","","ListBox1","SelectString", $sString) $sText = ControlCommand("Test", "", "ListBox1", "GetCurrentSelection") MsgBox(0, "Text read was:", $sText) I still get the same results. It selects the proper user (TEST5), however in a realworld enviroment I have to verify (due to errors with some user accounts) that it is the user selected before moving to the next step. Text read was: 0 Thanks for your help! Paul Edited July 17, 2008 by OrthodoxyUSA Link to comment Share on other sites More sharing options...
MrCreatoR Posted July 17, 2008 Share Posted July 17, 2008 I still get the same results.Because you are using "Test" as title muttley #include <GUIConstantsEx.au3> #include <GUIListBox.au3> Opt("WinSearchChildren", 1) WinWaitActive("Microsoft Dynamics GP - Customer Service Mgt") WinWait("User Access Setup") ControlFocus("User Access Setup", "", "ListBox1") $sString = "TEST5" ControlCommand("User Access Setup", "", "ListBox1", "SelectString", $sString) $sText = ControlCommand("User Access Setup", "", "ListBox1", "GetCurrentSelection") MsgBox(0, "Text read was:", $sText) Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
OrthodoxyUSA Posted July 17, 2008 Author Share Posted July 17, 2008 Because you are using "Test" as title muttley #include <GUIConstantsEx.au3> #include <GUIListBox.au3> Opt("WinSearchChildren", 1) WinWaitActive("Microsoft Dynamics GP - Customer Service Mgt") WinWait("User Access Setup") ControlFocus("User Access Setup", "", "ListBox1") $sString = "TEST5" ControlCommand("User Access Setup", "", "ListBox1", "SelectString", $sString) $sText = ControlCommand("User Access Setup", "", "ListBox1", "GetCurrentSelection") MsgBox(0, "Text read was:", $sText) You are correct... I tried this too... #include <GUIConstantsEx.au3> #include <GUIListBox.au3> AutoItSetOption("winsearchchildren", 1) WinWaitActive("Microsoft Dynamics GP - Customer Service Mgt") Sleep(2000) WinActive("User Access Setup","") ControlFocus("User Access Setup","","ListBox1") $sString = "TEST5" ControlSend("User Access Setup","","ListBox1","SelectString", $sString) $sText = ControlCommand("User Access Setup", "", "ListBox1", "GetCurrentSelection") MsgBox(0, "Text read was:", $sText) This time I got... Text read was: (a square) Paul Link to comment Share on other sites More sharing options...
MrCreatoR Posted July 17, 2008 Share Posted July 17, 2008 I tried this too...Try my example. You are using ControlSend wrong, «SelectString» is a string to send, but $sString is the last parameter, wich is used to define how "keys" is processed (see help file). I used ControlCommand(), not ControlSend(). Text read was: (a square)Perhaps it can not read correctly from the ListBox... Instead of runing whole script, just open manualy the window with the listbox, and run this two lines: $sText = ControlCommand("User Access Setup", "", "ListBox1", "GetCurrentSelection") MsgBox(0, "Text read was:", $sText) What you get? Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
OrthodoxyUSA Posted July 17, 2008 Author Share Posted July 17, 2008 Try my example. You are using ControlSend wrong, «SelectString» is a string to send, but $sString is the last parameter, wich is used to define how "keys" is processed (see help file). I used ControlCommand(), not ControlSend(). Perhaps it can not read correctly from the ListBox... Instead of runing whole script, just open manualy the window with the listbox, and run this two lines: $sText = ControlCommand("User Access Setup", "", "ListBox1", "GetCurrentSelection") MsgBox(0, "Text read was:", $sText) What you get? I guess I'm showing how tired I am. muttley Using your example... Text read was: 0 (no matter what I had selected.) Thanks much. Paul Link to comment Share on other sites More sharing options...
MrCreatoR Posted July 17, 2008 Share Posted July 17, 2008 (edited) Text read was: 0What you get with this: $iWinExists = WinExists("User Access Setup") $sText = ControlCommand("User Access Setup", "", "ListBox1", "GetCurrentSelection") MsgBox(0, "", "Error = " & @error & ", WinExists = " & $iWinExists)oÝ÷ Øò¢è´Jë¢ Edited July 17, 2008 by MrCreatoR Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
OrthodoxyUSA Posted July 17, 2008 Author Share Posted July 17, 2008 (edited) What you get with this: $iWinExists = WinExists("User Access Setup") $sText = ControlCommand("User Access Setup", "", "ListBox1", "GetCurrentSelection") MsgBox(0, "", "Error = " & @error & ", WinExists = " & $iWinExists)oÝ÷ Øò¢è´Jë¢ On the first one I got just what you predicted. «Error = 0, WinExists = 1» On the second I get a square box. Like a checkbox. No luck so far. It is very kind of you to be such a help. muttley Paul Edited July 17, 2008 by OrthodoxyUSA Link to comment Share on other sites More sharing options...
OrthodoxyUSA Posted July 18, 2008 Author Share Posted July 18, 2008 Anybody else got any ideas? Paul Link to comment Share on other sites More sharing options...
MrCreatoR Posted July 18, 2008 Share Posted July 18, 2008 On the second I get a square box. Like a checkbox.Can you please show a screenshot? Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
OrthodoxyUSA Posted July 19, 2008 Author Share Posted July 19, 2008 Can you please show a screenshot?As requested.Thanks much. muttley Link to comment Share on other sites More sharing options...
MrCreatoR Posted July 20, 2008 Share Posted July 20, 2008 Hm, that strange, perhaps the ListBox is not a standard listbox control. If i just could test it somewhere... Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
OrthodoxyUSA Posted July 20, 2008 Author Share Posted July 20, 2008 Hm, that strange, perhaps the ListBox is not a standard listbox control. If i just could test it somewhere...I agree, tis strange.How else can I test what is selected before I move on to the next step?I don't suppose you have a copy of MS Dynamics Great Plains to test with...BTW~ Thanks for helping!Paul Link to comment Share on other sites More sharing options...
MrCreatoR Posted July 20, 2008 Share Posted July 20, 2008 How else can I test what is selected before I move on to the next step?Try this: #include <GUIConstantsEx.au3> #include <GUIListBox.au3> Opt("WinSearchChildren", 1) WinWaitActive("Microsoft Dynamics GP - Customer Service Mgt") WinWait("User Access Setup") WinActivate("User Access Setup") WinWaitActive("User Access Setup") $hList = ControlGetHandle("User Access Setup", "", "ListBox1") $sString = "TEST5" ControlCommand("User Access Setup", "", "ListBox1", "SelectString", $sString) $sText = _GUICtrlListBox_GetSelItemsText($hList) MsgBox(0, "", "Text read was: " & $sText[1]) Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
OrthodoxyUSA Posted July 21, 2008 Author Share Posted July 21, 2008 Try this: #include <GUIConstantsEx.au3> #include <GUIListBox.au3> Opt("WinSearchChildren", 1) WinWaitActive("Microsoft Dynamics GP - Customer Service Mgt") WinWait("User Access Setup") WinActivate("User Access Setup") WinWaitActive("User Access Setup") $hList = ControlGetHandle("User Access Setup", "", "ListBox1") $sString = "TEST5" ControlCommand("User Access Setup", "", "ListBox1", "SelectString", $sString) $sText = _GUICtrlListBox_GetSelItemsText($hList) MsgBox(0, "", "Text read was: " & $sText[1]) Hmmm.... I get an error. MsgBox(0, "", "Text read was: " & $sText[1]) MsgBox(0, "", "Text read was: " & ^ ERROR If I run it without [1], I get nothing in my MsgBox. Paul Link to comment Share on other sites More sharing options...
MrCreatoR Posted July 21, 2008 Share Posted July 21, 2008 Hmmm.... I get an error.The item is selected? Can you Try instead _GUICtrlListBox_GetSelItemsText just use _GUICtrlListBox_GetText($hList, 1), what you get?I think the listbox you got there is not a standard listbox... Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
MrCreatoR Posted July 21, 2008 Share Posted July 21, 2008 One more shot: expandcollapse popup#include <GUIConstantsEx.au3> #include <GUIListBox.au3> Opt("WinSearchChildren", 1) WinWaitActive("Microsoft Dynamics GP - Customer Service Mgt") WinWait("User Access Setup") WinActivate("User Access Setup") WinWaitActive("User Access Setup") $hList = ControlGetHandle("User Access Setup", "", "ListBox1") _GUICtrlListBox_SetCurSel($hList, 1) $sText = _GUICtrlListBox_GetSelItemsTextEx($hList) MsgBox(0, "", "Text read was: " & $sText) Func _GUICtrlListBox_GetSelItemsTextEx($hWnd) Local $iI, $iCount, $tArray, $sRet = "" $iCount = _SendMessage($hWnd, $LB_GETSELCOUNT) If $iCount > 0 Then $tArray = DllStructCreate("int[" & $iCount & "]") _SendMessage($hWnd, $LB_GETSELITEMS, $iCount, DllStructGetPtr($tArray), 0, "wparam", "ptr") For $i = 1 To $iCount $iIndex = DllStructGetData($tArray, 1, $i) Local $struct = DllStructCreate("char Text[" & _SendMessage($hWnd, $LB_GETTEXTLEN, $iIndex) + 1 & "]") _SendMessage($hWnd, $LB_GETTEXT, $iIndex, DllStructGetPtr($struct), 0, "wparam", "ptr") $sRet &= DllStructGetData($struct, "Text") & @CRLF Next EndIf Return StringStripWS($sRet, 3) EndFunc Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
OrthodoxyUSA Posted July 21, 2008 Author Share Posted July 21, 2008 One more shot: expandcollapse popup#include <GUIConstantsEx.au3> #include <GUIListBox.au3> Opt("WinSearchChildren", 1) WinWaitActive("Microsoft Dynamics GP - Customer Service Mgt") WinWait("User Access Setup") WinActivate("User Access Setup") WinWaitActive("User Access Setup") $hList = ControlGetHandle("User Access Setup", "", "ListBox1") _GUICtrlListBox_SetCurSel($hList, 1) $sText = _GUICtrlListBox_GetSelItemsTextEx($hList) MsgBox(0, "", "Text read was: " & $sText) Func _GUICtrlListBox_GetSelItemsTextEx($hWnd) Local $iI, $iCount, $tArray, $sRet = "" $iCount = _SendMessage($hWnd, $LB_GETSELCOUNT) If $iCount > 0 Then $tArray = DllStructCreate("int[" & $iCount & "]") _SendMessage($hWnd, $LB_GETSELITEMS, $iCount, DllStructGetPtr($tArray), 0, "wparam", "ptr") For $i = 1 To $iCount $iIndex = DllStructGetData($tArray, 1, $i) Local $struct = DllStructCreate("char Text[" & _SendMessage($hWnd, $LB_GETTEXTLEN, $iIndex) + 1 & "]") _SendMessage($hWnd, $LB_GETTEXT, $iIndex, DllStructGetPtr($struct), 0, "wparam", "ptr") $sRet &= DllStructGetData($struct, "Text") & @CRLF Next EndIf Return StringStripWS($sRet, 3) EndFunc Sorry, Again, I get an empty reply... Text read was: I think you are correct, this is not a standard box. I am now working on solving this problem using an OSQL statement. Thanks so much for you time. Forgive me... Paul 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