Jump to content

AutoIt mouse position and automation


Recommended Posts

Hi folks

I'm building an app to automate logging into a website, entering various search criteria, performing searches etc.

So far I've been able to...

1) Login

Func Login()
    MouseClick("left", 981, 202)
    Send($username)
    MouseClick("left", 981, 240)
    Send($password)
    MouseClick("left", 981,290)
EndFunc

2) Enter Search criteria

Func Search()
MouseClick("left", 300, 300)
Send($searchCriteria)
MouseClick("left", 300, 420)
EndFunc

I've embedded a browser in a GUI and locked the GUI so it cannot be moved.

Example:

$oIE = _IECreateEmbedded()
GUICreate("gui", 1200, 720, 5, 5)
GUICtrlCreatePic('bg.bmp', 0, 0, 1200, 720)
GuiCtrlSetState(-1,$GUI_DISABLE)
GUISetFont(9, 1, 3, "verdana")

$GUIActiveX = GUICtrlCreateObj($oIE, 10, 10, 1180, 600)

It works on my PC but my fear is that it won't be portable. What if another user has a different screen resolution from me? is x=981, y=240 981 in from the GUI or from the edge of my screen? I tried

_IEFormGetObjByName
but that only allowed me to enter my credentials, not actually log in.

Some advice on the best way to do this would be very much appreciated :)

Link to comment
Share on other sites

See PixelCoordMode in the Help file. Also, there are better ways to send data to a web page, search thru the forum for examples, and read thru the Help file again, <b>IE Management</b> in the <b>User Defined Function Reference </b>section<b>.<br></b>

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

Thanks somdcomputerguy.

I've been using the tool in AutoIt AU3Info to capture the co-ordinates. Can you tell me if that is the absolute position or the position from the top and left of the GUI?

Thanks :)

*EDIT* - just noticed you can choose the setting in the tool itself :)

Edited by kiffab
Link to comment
Share on other sites

In the Options menu of AU3Info, you can select the coord mode, which will dictate what kind of coords are being returned by the tool. Set PixelCoordMode accordingly in your script.<br><br>Edit: just noticed you noticed..<br>

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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