This App is No Longer Maintained. Visit the Replacement at StrokesPlus.net

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
 Emulate mouse click in a current coordinates
 New Topic  Reply to Topic
 Printer Friendly
Author  Topic Next Topic  

poweruser84

Russia
24 Posts

Posted - 06/20/2013 :  09:10:55  Show Profile  Reply with Quote
Hi all

Please help me to customize StrokesPlus.
I want to emulate mouse click in a current coordinates (where is cursor's position). How i can do that?

Edited by - poweruser84 on 06/20/2013 09:25:47

Rob

USA
2606 Posts

Posted - 06/20/2013 :  09:25:47  Show Profile  Visit Rob's Homepage  Reply with Quote
Without knowing more details, it's difficult to give you precise assistance, but here is an example of sending a right mouse click to the current cursor location:

acMouseClick(acGetMouseLocationX(), acGetMouseLocationY(), 0, 1, 1)
Go to Top of Page

poweruser84

Russia
24 Posts

Posted - 06/20/2013 :  10:22:17  Show Profile  Reply with Quote

Thank you, Rob, for the quick assistance you have provided. Thank you for great software. I am looking forward with the StrokesPlus.

I want to configure wheel scrolls in the video player's child window.
Based on my idea, pressing the "Stroke button" with Scroll down and Scroll up over the video player's child window should:
- emulate left mouse click (to activate window under cursor, in a case when it's not in active state)
- emulate RIGHT and LEFT keyboard buttons within the child window (player's window "Overview of scenes", i am using it for switching between episodes) to perform necessary actions

I have configured new application rule for video player's child window and enabled "Do not process Global Action for this app, only app actions". It works pretty well in a such configuration:

Mouse modifiers: Scroll up
Modifier check: After Stroke button down
Lua script:
acSendKeys("{LEFT}")


Mouse modifiers: Scroll down
Modifier check: After Stroke button down
Lua script:
acSendKeys("{RIGHT}")


But when i have added command to emulate left mouse click:
acMouseClick(acGetMouseLocationX(), acGetMouseLocationY(), 2, 1, 1) (as a first line in app's lua script) it doesn't work anymore. "Overview of scenes" window closing when i am trying to perform StrokesPlus's action.

Is there way to emulate left mouse click (or activate window under cursor) using scroll down and scroll up modifiers?

P.S.: Also i have Global Action and Global lua script binded to scroll down/up for fast switching of windows (it based on your Win_button+Tab (Windows aero) switching solution). I tried to disable these action/scripts but that didn't help at all.
Go to Top of Page

Rob

USA
2606 Posts

Posted - 06/20/2013 :  10:48:55  Show Profile  Visit Rob's Homepage  Reply with Quote
What video player are you using? Sending a mouse click while you're still holding the stroke mouse button will likely cause you to have problems as it creates a confusing state for Windows, S+, and its state management (discerning between a sent key, still knowing that you're holding the stroke button, etc.)

It sounds like you simply need to activate the window, which should be easy enough to accomplish. However, each program can be a little different, so knowing what software you're attempting to work with will help.
Go to Top of Page

poweruser84

Russia
24 Posts

Posted - 06/20/2013 :  11:13:44  Show Profile  Reply with Quote
Rob, you right. I need to activate the window and then perform an action.

Can you provide example of script for activation of child (or parent) window which is under mouse cursor?

Edited by - poweruser84 on 06/20/2013 11:14:27
Go to Top of Page

Rob

USA
2606 Posts

Posted - 06/20/2013 :  11:25:16  Show Profile  Visit Rob's Homepage  Reply with Quote
This will attempt to activate the window under the cursor:

acActivateWindow(acGetWindowByPoint(acGetMouseLocationX(), acGetMouseLocationY()),0,0)

Note that the term "window" means "control" really. For example, a text box is techincally a "window", meaning it has its own window handle. acGetWindowByPoint would get the handle of the text box itself (in this example).

This:

acActivateWindow(acGetParentWindowByPoint(acGetMouseLocationX(), acGetMouseLocationY()),0,0)

Will get the parent of the text box (recursively calling acGetPArentWindowByPoint, passing in the last handle, will continually walk up the window ownership hierarchy until reaching the very top).

This:

acActivateWindow(acGetOwnerWindowByPoint(acGetMouseLocationX(), acGetMouseLocationY()),0,0)

Will get the owner of the window (control), usually the owner will be the top-level (main application window).

So, it can sometimes be tricky to ensure you're getting the right window, but start with some of these and see if you have any luck.

Go to Top of Page

poweruser84

Russia
24 Posts

Posted - 06/20/2013 :  14:49:32  Show Profile  Reply with Quote
Very useful. Thank you Rob!
Go to Top of Page

HeavenElite

1 Posts

Posted - 03/17/2020 :  02:00:19  Show Profile  Reply with Quote
quote:
Originally posted by Rob

Without knowing more details, it's difficult to give you precise assistance, but here is an example of sending a right mouse click to the current cursor location:

acMouseClick(acGetMouseLocationX(), acGetMouseLocationY(), 0, 1, 1)



Thank you Very much, Mr. Rob
I'm new for StrokesPlus and modified it to
acMouseClick(acGetMouseLocationX(), acGetMouseLocationY(), 2, 1, 1)

Then added this script before each acSendKeys lines.
So, no matter the text box in a web page or address bar is enabled or not, Shortcuts will be sent to the Tab or Window successfully

However, my personal settings can't be exported & imported to the latest S+ version.
And, I'm about to prepare half a day for this transfer.
Go to Top of Page
   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