StrokesPlus Forum
                       
StrokesPlus Forum
Home | Profile | Register | Active Topics
Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General Discussion
 General Discussion
 [Solved]Mouse moves/clicks to relative position...
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

AxJ

28 Posts

Posted - 06/07/2019 :  01:53:56  Show Profile  Reply with Quote
I want mouse moves/clicks to the relative position of the current window.
In AutoHotkey, I can get the position(Left/Top x,y) and the size(Right/Bottom x,y) of the window I'm using. Thus, the mouse cursor can go to the relative position I want.
(How)Can I do that in S+?

Scenario: I want to close the download file message in the right/bottom corner of Google Chrome by clicking the "x" icon. But the size and position of Chrome may change sometimes.

Edited by - AxJ on 07/27/2019 02:06:49

Rob

USA
2581 Posts

Posted - 06/07/2019 :  06:12:49  Show Profile  Visit Rob's Homepage  Reply with Quote
You can get the locations of each window edge using these:

acGetWindowLeft
acGetWindowTop
acGetWindowRight
acGetWindowBottom
Go to Top of Page

AxJ

28 Posts

Posted - 06/07/2019 :  12:25:59  Show Profile  Reply with Quote
Ok, I'll try to figure it out how to use them to achieve my goal.
Thanks!
Go to Top of Page

AxJ

28 Posts

Posted - 07/19/2019 :  23:53:21  Show Profile  Reply with Quote
Hi, I've read the help file and tried some commands but I can't get it to work. The mouse cursor goes nowhere.
And I stil don't understand what does it mean by "gets the handle of the window at the x and y coordinates." Which point/pixel on the top/right/bottom/left side?
Also, can I get the x coordinate from the right side and y coordinate from the top side at the same time?

acGetWindowTop(nil, gsx, gsy)
acDelay(50) 
acMouseClick((gsx-5), (gsy+95), 2, 1, 1)
Go to Top of Page

Rob

USA
2581 Posts

Posted - 07/22/2019 :  07:52:21  Show Profile  Visit Rob's Homepage  Reply with Quote
acGetWindowTop(nil, gsx, gsy) returns the top (y) coordinate part for the window location where the gesture started (gsx, gsy) [Gesture Start X / Y]

You have to assign the return value to something or nothing happens.
Something kind of like this:
local wndTop = acGetWindowTop(nil, gsx, gsy)
local wndLeft = acGetWindowLeft(nil, gsx, gsy)
acMouseMove(wndLeft-5, wndTop+95)
acDelay(10)
acMouseClick(wndLeft-5, wndTop+95, 2, 1, 1)

I haven't tested this, but this is the general idea anyway, plus I'm not sure exactly which part of the coordinate you're trying to modify so my numbers (-5 and +95) might be swapped.
Go to Top of Page

AxJ

28 Posts

Posted - 07/27/2019 :  01:37:45  Show Profile  Reply with Quote
Thank you! I finally understand these!!! It seems I keep making the same mistake forgetting to assign a variable to catch the return value. XD
So,
acGetWindowLeft/Top will return respectively the x & y(which is the coordinate of the top/left most corner) of the current window &
acGetWindowRight/Bottom will return respectively the x & y(which is the coordinate of the right/bottom most corner) of the current window, that is the same number of the size of it.
My commands:

local yofTop             = acGetWindowTop(nil, gsx, gsy)
local xofLeft            = acGetWindowLeft(nil, gsx, gsy)
local xofRight (width)   = acGetWindowRight(nil, gsx, gsy)
local yofBottom (height) = acGetWindowBottom(nil, gsx, gsy)
--acMouseMove(w-12, y+95)
acDelay(10)
acMouseClick(xofRight-12, yofTop+95, 2, 1, 1)
acMouseMove(gex,gey)

Edited by - AxJ on 07/27/2019 06:41:35
Go to Top of Page

Rob

USA
2581 Posts

Posted - 07/27/2019 :  05:12:45  Show Profile  Visit Rob's Homepage  Reply with Quote
Regarding the width and height, not necessarily. It is simply the location of the right and bottom edges of the rectangle. Same with left and top, just the location of the edges.

If your screen location doesn't start at 0,0 then right and bottom won't be what you're assuming.

In reality:
Width = right - left
Height = bottom - top
Go to Top of Page

AxJ

28 Posts

Posted - 07/27/2019 :  06:36:04  Show Profile  Reply with Quote
Oh...You're right! I over-interpreted it.
Thanks for the correction!!!

Edited by - AxJ on 07/27/2019 21:27:01
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
StrokesPlus Forum © 2011-2018 Rob Yapchanyk Go To Top Of Page
Snitz Forums 2000