StrokesPlus Forum
                       
StrokesPlus Forum
Home | Profile | Register | Active Topics
Members | Search | FAQ
 All Forums
 General Discussion
 General Discussion
 [Solved]Mouse moves/clicks to relative position...

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
AxJ Posted - 06/07/2019 : 01:53:56
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.
7   L A T E S T    R E P L I E S    (Newest First)
AxJ Posted - 07/27/2019 : 06:36:04
Oh...You're right! I over-interpreted it.
Thanks for the correction!!!
Rob Posted - 07/27/2019 : 05:12:45
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
AxJ Posted - 07/27/2019 : 01:37:45
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)
Rob Posted - 07/22/2019 : 07:52:21
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.
AxJ Posted - 07/19/2019 : 23:53:21
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)
AxJ Posted - 06/07/2019 : 12:25:59
Ok, I'll try to figure it out how to use them to achieve my goal.
Thanks!
Rob Posted - 06/07/2019 : 06:12:49
You can get the locations of each window edge using these:

acGetWindowLeft
acGetWindowTop
acGetWindowRight
acGetWindowBottom

StrokesPlus Forum © 2011-2018 Rob Yapchanyk Go To Top Of Page
Snitz Forums 2000