Jump to content

au3record and mouse coordinates


ayatest
 Share

Recommended Posts

I'm not exactly from programming sector (navigating in formal programming langs is not easy for me), so my apologises if my questions sound silly.

I'd like to simulate mouse clicks on multiple applications, and using AU3Record 3.3 - encountered a small problem. So here is the scenario and question.

Let say that I have 2 apps open on the screen, app1 and app2. When using AU3Record - I noticed, that it switches between apps automatically, depending on where I click, something like this:

_WinWaitActivate("app1","")
MouseClick("left",191,14,1)

_WinWaitActivate("app2","")

MouseClick("left",96,11,1)

Now - everything would be fine, but I noticed that AU3Record stores relative positions of mouse cursor in regards to activated app. But apps are in different locations on the screen area. So if I try to do a simple script, like this:

WinWaitActive("[CLASS:app1.exe]", "", 2)
MouseClick("left",191,14,1)
WinWaitActive("[CLASS:app2.exe]", "", 2)
MouseClick("left",96,11,1)

then the mouse is using absolute screen coordinates (or relative coordinates of the app1, I don't know; first ap is glued to top/left corner of the screen), and thus - it isn't moving to app2.

Basically using relative coordinates is better for me, because app can be not maximized, and I can use such script on various machines.

So here the question. How to make it, so that I can select app1 - and MouseClick relative coordinates operate within app1 boundaries, and I can select app2 and mouse coordinates operate within app2 boundaries?

(Do I need to do something more if I wish to use app keyboard shortcuts as well?)

functional testing. multimedia recording. flowstone. mouseclick, hotkeys and modularity in general.

Link to comment
Share on other sites

Something is missing or I don't understand it. When I place this in the script (no matter whether above these example lines or per WinWaitActive section) - mouse positions are relative to... folder within which I started the script. So the mouse isn't moving to apps at all, it stays within folder boundaries. Should this be like this or something else is required?

Opt("MouseCoordMode", 0)

WinWaitActive("[CLASS:app1.exe]", "", 2)
MouseClick("left",191,14,1)
WinWaitActive("[CLASS:app2.exe]", "", 2)
MouseClick("left",96,11,1)

(Btw, I work in Flowstone, so it works only with clicking)

Edited by ayatest

functional testing. multimedia recording. flowstone. mouseclick, hotkeys and modularity in general.

Link to comment
Share on other sites

Look in the help file for better ways to click controls:

WinGetHandle
WinActivate
ControlGetHandle
ControlFocus
ControlClick
ControlSetText

The recorder will never be reliable enough for something you want to do repeatedly with accuracy.

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

It would be helpful to see working example, that's why I generalized the code. Blind experimentation isn't helping me too much, because there is a lot of terminology that I don't understand or don't know what it is (btw, english is also not my language). (Environment in which I work is nothing like regular programming language; it's modular visual dataflow, based on virtual cables and modules instead of written code; as far I know, FS apps are rendered internally, they don't have sub-windows like standard win apps).

At the moment, I'm stuck with this. To describe the scenario visually. Let say that I have (already opened) app1 on the top/left, app2 on the top/right, and folder with script - below them. If I use nothing, then mouse captured by au3record (coordinates relative to current gui in use) - operates only on the top/left area (app1), and it isn't following app2 area. If I add to the code Opt("MouseCoordMode", 0) parameter, then after starting the script - mouse starts clicking on the area of the work folder instead of moving to app1.

So the original question reamains. If the MouseClick coordinates captured by au3record are relative to currently active app - then how to switch the app, so that relative coordinates are used in conjunction with proper app/window?

Using relative mouse coordinates combined with app main window - is enough for me. If winow moves on the screen somewhere, then it will make no difference.

Edited by ayatest

functional testing. multimedia recording. flowstone. mouseclick, hotkeys and modularity in general.

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...