Jump to content

If @DesktopHeight= Then MouseClick


Recommended Posts

I'm trying to click on a login button in a CLASS:WindowsForms10.Window9.app.0.XXXXXXX(these characters always change). AU3Info is unable to select the button directly and I'm unable to select it with keyboard shortcuts. The only way I have to click on it is thru a MouseClick. That should work great, but I know there is going to be the rare occasion that the client's resolution will be different.

Fortunately I know it will only be 1 of 4 resolutions. Is it possible to do something like IF/THEN MouseClick statement for the multiple resolutions against @DesktopHeight? For example:

@DesktopHeight=768 Then MouseClick("left", 747, 37, 1, 1); 1024x768

@DesktopHeight=864 Then MouseClick("left", 875, 36, 1, 1); 1152x864

@DesktopHeight=960 Then MouseClick("left", 1007, 37, 1, 1); 1280x960

@DesktopHeight=1024 Then MouseClick("left", 1006, 36, 1, 1); 1280x1024

What would that syntax look like?

Link to comment
Share on other sites

Besides the nested if's, if the screen retains it's proportions you might be able to hit the center of the button using a ratio of the screen size, like:

MouseClick("left", @DesktopWidth * .75, 36, 1, 1) ; 75% of screen

Or, you could hardcode the values in a table and use a loop, like:

Global $aButtonMap[3][2] = [[1024, 747],[1152, 875],[1280, 1006]]
For $x = 0 to 2
    If @DesktopWidth = $aButtonMap[$x][0] Then
        MouseClick("left", $aButtonMap[$x][1], 36, 1, 1)
        ExitLoop
    EndIf
Next

But my main goal would be to use ControlClick(). Have you tried the other methods of referencing the control? Don't any of the AU3Info values, like the Advanced Mode data (CLASS:xxx;INSTANCE:xxx), remain constant?

Edited by Spiff59
Link to comment
Share on other sites

*sigh* People. You've missed something...

Here... I'll quote it for you...

I'm trying to click on a login button in a CLASS:WindowsForms10.Window9.app.0.XXXXXXX(these characters always change).

Still don't see it?

OK.

I'm trying to click on a login button in a CLASS:WindowsForms10.Window9.app.0.XXXXXXX(these characters always change).

...

There's a precedent that's been set where topics that discuss this are locked.

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to comment
Share on other sites

That applies to web site logins, from the form name he used, I'm not sure this is in a browser.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Trivial problem, suggested solution is rubbish, thread locked because I'm in a pissy mood because our MVPs are dumb and this thread is borderline on the rules anyway.

No I won't help you via PM. No you can't create a new thread on this. I suggest you read the documentation because there's more ways MouseClick() can work than just absolute coordinates.

Edited by Valik
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...