water Posted February 4, 2013 Posted February 4, 2013 (edited) I'm running Adobe Reader 10.1.5 on Windows 7 64 bit german version. AutoIt is 3.3.8.1 and 3.3.9.4. When I try to extract the currently selected printer from the combobox I always get the first 4 correct characters (the correct result has about 20 characters). Sometimes the returned string is longer but contains garbage from character 5 onwards. Examples (text in [] is a single control character display with black background): EG[DC1][GS][sTX] EGainThreadWndClass I open a PDF file and then run the following test script: #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_UseX64=n $sAdobeWindow = "Adobe Reader" ; <== Window title for the PDF document $sPrintDialog = "Drucken" ; <== Window title for the print dialog AutoItSetOption("WinTitleMatchMode", 2) ConsoleWrite("1: " & @error & @LF) $Result = WinActivate($sAdobeWindow) ConsoleWrite("2: " & $Result & @LF) $Result = Send("^p") ConsoleWrite("3: " & @error & @LF) $Result = WinWait($sPrintDialog, "") ConsoleWrite("4: " & $Result & @LF) $Result = WinActivate($sPrintDialog, "") ConsoleWrite("5: " & $Result & @LF) $Result = ControlCommand($sPrintDialog, "", "[CLASS:ComboBox; INSTANCE:1]", "GetCurrentSelection", "") ConsoleWrite("6: " & $Result & "-" & @error & "-" & StringLen($Result) & @LF) I ran the script as 32 and 64 from SciTE and compiled with/without UPX. Tried several PDF documents, restarted the computer but always get the same result. Does anyone know what's going on? The final goal is not to query the current selection but to set a new printer. Edit: The AutoIt Window Info Tools result for the ComboBox: >>>> Control <<<< Class: ComboBox Instance: 1 ClassnameNN: ComboBox1 Name: Advanced (Class): [CLASS:ComboBox; INSTANCE:1] ID: Text: Position: 69, 15 Size: 250, 24 ControlClick Coords: 162, 12 Style: 0x56000413 ExStyle: 0x00000000 Handle: 0x0000000000020B20 Edited February 4, 2013 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
junkew Posted February 5, 2013 Posted February 5, 2013 Maybe you can find more information with UIAutomation FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
water Posted February 5, 2013 Author Posted February 5, 2013 Looks like a bit of an overkill to get the content of a ComboBox. Because this should be possible with Autoit commands. It works (somehow) but just doesn't return the full entry. Maybe a bug? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
stormbreaker Posted February 6, 2013 Posted February 6, 2013 Perhaps, simple workaround (just select your printer in combo-box and then run this code):ControlClick('Print', '', '[CLASS:Button; INSTANCE:1; TEXT:&Properties]') ;Sometimes doesn't work in the first place ControlClick('Print', '', '[CLASS:Button; INSTANCE:1; TEXT:&Properties]') Sleep(1000) Const $TITLE = WinGetTitle("[ACTIVE]") $PRINTERNAME = StringReplace($TITLE, ' Properties', '') WinClose($TITLE) msgbox(64, '', 'Printer active: ' & $PRINTERNAME)Works nice for me, I use Samsung SCX-4300 series. ControlGetText, ControlCommand etc. are not working for me as well. ---------------------------------------- :bye: Hey there, was I helpful? ---------------------------------------- My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1
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