HollyN Posted May 6, 2009 Share Posted May 6, 2009 I have a script that automates a login sequence for a Terminal Server application that requires one-time authentication and license validation. I am running it following the installation of the app, and it is working almost perfectly. I just have one niggle. The initial login dialog box has two states: collapsed, where two of the fields are hidden, and open, where all of the fields are exposed. In order for my script to run correctly, I need to be sure the box is open. That is controlled by an Options button, which changes text from "Options >>" to "Options <<" depending on the state of the window. I need to test for the state of the dialog box, and then 'click' the Options button to expand it if it is in the wrong state. I have checked with both the AutoIt Window Info tool and UIspy, and I don't see any obvious differences other than the text on the button. I thought I might approach it with something like this (in English): if button text = "Options>>" then ControlClick the button go on with the rest of the script I'm not a programmer, and this has exceeded my skills. Any suggestions? Am I approaching this all wrong? Link to comment Share on other sites More sharing options...
bo8ster Posted May 6, 2009 Share Posted May 6, 2009 Can u post the output of the info window (Summary) when over the Options section? You should be able to get a handle to the label. In the Summary all the text is displayed - that might be able to use that too. Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic] Link to comment Share on other sites More sharing options...
HollyN Posted May 6, 2009 Author Share Posted May 6, 2009 Yep, here are both Summary outputs. The two significant differences I see are the Text on the Button, and the shift of the additional fields from Hidden Text to Visible Text. Hmm, maybe I can test for Visible Text instead of the Button label. But I still don't know how. Thanks for your help. ====================================== COLLAPSED >>>> Window <<<< Title: JD Edwards EnterpriseOne Login Class: jdedlg Position: 316, 29 Size: 452, 380 Style: 0x94C008C4 ExStyle: 0x00010101 Handle: 0x00060296 >>>> Control <<<< Class: Button Instance: 4 ClassnameNN: Button4 Advanced (Class): [CLASS:Button; INSTANCE:4] ID: 1070 Text: &Options >> Position: 282, 203 Size: 119, 26 ControlClick Coords: 62, 14 Style: 0x50010001 ExStyle: 0x00000004 Handle: 0x0006026E >>>> Mouse <<<< Position: 663, 268 Cursor ID: 2 Color: 0xD4D0C8 >>>> StatusBar <<<< >>>> Visible Text <<<< &User ID: JDEINST JDEINST &Password: Copyright © 2003-2005, Oracle. All rights reserved. Oracle, JD Edwards, PeopleSoft, and Retek are registered trademarks of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. SIGNON JPEG OK Cancel &Options >> Legal Info - >>>> Hidden Text <<<< &Environment: WPD810 &Role: *ALL ====================================== EXPANDED >>>> Window <<<< Title: JD Edwards EnterpriseOne Login Class: jdedlg Position: 316, 29 Size: 452, 473 Style: 0x94C008C4 ExStyle: 0x00010101 Handle: 0x00060296 >>>> Control <<<< Class: Button Instance: 4 ClassnameNN: Button4 Advanced (Class): [CLASS:Button; INSTANCE:4] ID: 1070 Text: &Options << Position: 282, 285 Size: 119, 26 ControlClick Coords: 41, 6 Style: 0x50010000 ExStyle: 0x00000004 Handle: 0x0006026E >>>> Mouse <<<< Position: 642, 342 Cursor ID: 2 Color: 0xD4D0C8 >>>> StatusBar <<<< >>>> Visible Text <<<< &User ID: JDEINST JDEINST &Password: &Environment: WPD810 WPD810 &Role: *ALL *ALL Copyright © 2003-2005, Oracle. All rights reserved. Oracle, JD Edwards, PeopleSoft, and Retek are registered trademarks of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. SIGNON JPEG OK Cancel &Options << Legal Info - >>>> Hidden Text <<<< ====================================== Link to comment Share on other sites More sharing options...
bo8ster Posted May 7, 2009 Share Posted May 7, 2009 This should be somewhat straight forward. Not going to do everything but here is a start. Look at WinGetHandle to create a $appHandle then use the $appHandle for ControlGetHandle. I would also use something like [CLASS:Button; TEXT:&Options >>] with ControlGetHandle From there you can test with ControlGetText. Give that a try, post your code if you get into any trouble. Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic] Link to comment Share on other sites More sharing options...
HollyN Posted May 7, 2009 Author Share Posted May 7, 2009 Crude, but it seems to work. It's obvious that I'm not a programmer. I'd be happy to consider more elegant suggestions - it will help me learn. Thanks! ============== $OptionsHandle=ControlGetHandle("JD Edwards EnterpriseOne Login", "", "Options <<") if $OptionsHandle="" then ControlClick("JD Edwards EnterpriseOne Login", "", "[iD:1070]") ============== Link to comment Share on other sites More sharing options...
bo8ster Posted May 8, 2009 Share Posted May 8, 2009 If that is working for you that is great - not sure how given that code. Using the ID will not as Control IDs are dynamically assigned they change every time the program loads. The three static things you can use are class, instance and the text. I see that they are indeed the same control but the text changes depending on the state. The output supplied stats for the text &Options >> I doubt there is & in the field but there is a way to check this. I would do the following: - I used instance as the text changes Local Const $appName = "JD Edwards EnterpriseOne Login" Run("path to your program") WinWaitActive($appName) Global Const $appHandle = WinGetHandle($appName) ; get a handle to the application. All other handles are based from this one Global Const $OptionsHandle = getOptionsHandleByInstance() If ControlGetText($OptionsHandle, "", "") == "Options <<" Then ; mouse click or something Else ;do something else EndIf Func getOptionsHandleByInstance() Local $handle = "" $handle = ControlGetHandle($appHandle, "", "[CLASS:Button; INSTANCE:4]") If $handle == "" Then MsgBox(0, "Handle Error", "getOptionsHandleByInstance Failed") Else MsgBox(0, "Handle Success", "The the label is " & ControlGetText($handle, "", "")) EndIf Return $handle EndFunc ;==>getOptionsHandleByInstance That should more then help you on your way - any questions post your code. Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic] 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