NearMadness Posted June 22, 2012 Share Posted June 22, 2012 Hi... I have a small script that automates a few clicks and control sends. However, I have a problem running the same script successfully using monitor resolutions different than mine. For example: My desktop resolution is 1440 x 905 An accurate/working instruction/line in my script that clicks on a radio button reads like this: MouseClick("left",333,15,1,0) However, if I want to do the same in another machine with a resolution of 1366 x 768 the line above fails. The equivalent and working code for this other resolution is: MouseClick("left",430,17,1,0) Now, the issue is, I can't anticipate the resolution of my script users thus, I need to somehow state the correct/corresponding coordinates in my script so that it works with the different aspect rations/resolutions they have. I use the AutoIt Window Info tool to get the coordinates and select the Coord Mode = Client option from the menu. In my script, I have these options: AutoItSetupOption("MouseCoordMode",2) AutoItSetupOption("CaretCoordMode",2) AutoItSetupOption("PixelCoordMode",2) I imagine everyone out there but me knows how to do this - and I feel ashamed about it... but I am terribly lost here after spending many hours with different ideas and searches for examples. I really appreciate if someone could please help!! Link to comment Share on other sites More sharing options...
stormbreaker Posted June 22, 2012 Share Posted June 22, 2012 Why use MouseClick on a Radio button when you could do this with ControlClick? ---------------------------------------- :bye: Hey there, was I helpful? ---------------------------------------- My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1 Link to comment Share on other sites More sharing options...
NearMadness Posted June 22, 2012 Author Share Posted June 22, 2012 > Why use MouseClick on a Radio button when you could do this with ControlClick?If I use the ControlClick function, I also have to speciy the Coords...For instance, with my base resolution (1440 x 900), the ControlClick coordinates are 317,13The equivalent user resolution (1366 x 768) ControlClick coordinates are 395,17... The issue is the same unless there's something more to this. Link to comment Share on other sites More sharing options...
stormbreaker Posted June 22, 2012 Share Posted June 22, 2012 (edited) Read the help-file carefully and try this code: msgbox(64, "", "Go to start menu and open Run Dialog, once it opens I will click OK button") WinWaitActive("Run", "") ControlClick("Run", "", "[TEXT:OK]", "Primary") I didn't specify coordinates!! Edited June 22, 2012 by MKISH ---------------------------------------- :bye: Hey there, was I helpful? ---------------------------------------- My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1 Link to comment Share on other sites More sharing options...
NearMadness Posted June 22, 2012 Author Share Posted June 22, 2012 Thanks Spammer, In your ControlClick you are able to specify "[TEXT:OK]" because you can see the text of the button with the Info Tool but the Powerbuilder form I am reading/scanning does not offer me the visible text for the radio button options. I can see the text for some of the other controls in the form but not for the options in the desired radio button. I will try to see if the script is able to detect the intended option by using your suggestion... perhaps that's all I needed to do. Link to comment Share on other sites More sharing options...
stormbreaker Posted June 22, 2012 Share Posted June 22, 2012 Its MKISH by the way, remember it Newbie... ---------------------------------------- :bye: Hey there, was I helpful? ---------------------------------------- My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1 Link to comment Share on other sites More sharing options...
NearMadness Posted June 22, 2012 Author Share Posted June 22, 2012 Thanks MKISH... Link to comment Share on other sites More sharing options...
NearMadness Posted June 22, 2012 Author Share Posted June 22, 2012 The test failed... the Text of the radio button options are not visible (like the OK button in your sample), so the script doesn't "find" it. Link to comment Share on other sites More sharing options...
stormbreaker Posted June 22, 2012 Share Posted June 22, 2012 point the AutoIt Window Info tool to radio button and tell us the output. ---------------------------------------- :bye: Hey there, was I helpful? ---------------------------------------- My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1 Link to comment Share on other sites More sharing options...
NearMadness Posted June 22, 2012 Author Share Posted June 22, 2012 >>>> Control <<<<Class: pbdw90Instance: 2ClassnameNN: pbdw902Name: Advanced (Class): [CLASS:pbdw90; INSTANCE:2]ID: 1007Text: Position: 17, 2Size: 393, 33ControlClick Coords: 317, 13Style: 0x56000000ExStyle: 0x00000000Handle: 0x00010700>>>> Mouse <<<<Position: 334, 15Cursor ID: 0Color: 0xFFFFFF Link to comment Share on other sites More sharing options...
stormbreaker Posted June 22, 2012 Share Posted June 22, 2012 The code: WinWaitActive("<Window Title>", "") ControlClick("<Window Title>", "", "[Class:pbdw90; Instance:2]", "Primary") Change <Window Title> according to your need ---------------------------------------- :bye: Hey there, was I helpful? ---------------------------------------- My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1 Link to comment Share on other sites More sharing options...
NearMadness Posted June 22, 2012 Author Share Posted June 22, 2012 Thanks MKISH... Your ControlClick code worked in the sense that it clicked right in the very center of the 5 options available but it didn't click the one I need (which is the right-most alternative/option)... understandable so I guess. Link to comment Share on other sites More sharing options...
NearMadness Posted June 22, 2012 Author Share Posted June 22, 2012 This particular control does not show the text of each option in the Info Tool as you pass over it... all you see changing are the mouse coordinates. Link to comment Share on other sites More sharing options...
NearMadness Posted June 22, 2012 Author Share Posted June 22, 2012 I am probably failing to explain... When you use the Info Tool on a form like the RUN form, the tool says text OK, text CANCEL and so forth... The control I need to click doesn't reveal that to the Info Tool... that's why I figure I am stuck having to hit whatever option I need via coordinates. Link to comment Share on other sites More sharing options...
AZJIO Posted June 22, 2012 Share Posted June 22, 2012 NearMadness$DW =@DesktopWidth $DH = @DesktopHeight Switch $DW&'x'&$DH Case '1280x1024' $x=15 $y=35 Case '1024x768' $x=25 $y=45 Case '1280x768' $x=15 $y=45 Case Else Exit EndSwitch MouseClick('left', $x, $y, 1, 0) ;i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i! Run('Calc.exe') $hWnd = WinWait("[CLASS:SciCalc]", "", 5) ; без таймаута (5) ожидание бесконечно If Not $hWnd Then MsgBox(4096, 'Error', 'Exit') Exit EndIf $WGP=WinGetPos($hWnd) If Not @error Then MouseClick('left', $WGP[0] + 75, $WGP[1] + 153, 1, 0) EndIf ; WinClose($hWnd) My other projects or all Link to comment Share on other sites More sharing options...
NearMadness Posted June 22, 2012 Author Share Posted June 22, 2012 Thanks AZJIO..! 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