Request: Mouse behavior mods, but only in-browser

28 views
Skip to first unread message

JC

unread,
Jul 27, 2021, 12:50:11 PM7/27/21
to autokey-users
I have the following code in AutoHotkey and I have no clue of whether it's doable in AutoKey.

For context: ^ means Control, + means Shift, and all code within two #If lines restricts itself to only being active if the upper #If condition is met (in this case, the active window must be one of the browsers specified):

=====================================

#If (WinActive("ahk_exe msedge.exe") || WinActive("ahk_exe Chrome.exe"))

; Hold one mouse button & tap the other anywhere on the screen to cycle through tabs (the second line is needed to prevent right-click from breaking)

RButton & LButton::Send ^+{Tab}
RButton::Send {RButton}
~LButton & RButton::Send ^{Tab}

; Hold the middle mouse button anywhere in the window for 0.35 sec to close the current tab

    ~MButton::
        KeyWait, MButton, t0.35
        if ErrorLevel
        {
            Send ^w
        }
        KeyWait, MButton
    return

#If

=====================================

Is this possible? I've been realizing I've been using this probably dozens of times a day in AutoHotkey ever since I figured it out.

jos...@main.nc.us

unread,
Jul 28, 2021, 2:50:14 AM7/28/21
to autoke...@googlegroups.com
You can probably do it, but only because Python can do almost anything.

However, this is similar to the theorem: If a string has one end, it has
another end. (which doesn't guarantee you can find it. :) )

A whole bunch of the upper levels of the desktop managers and utilities
are written in Python, so it's quite capable, but it requires significant
expertise to get it to jump through hoops.

You can use AutoKey to start up a Python script, but there's nothing in
the API that does what you want.

The other alternative is to actually run AutoHotKey on Linux. Somebody
showed us how to do that recently, but I'm not sure where it was posted.

If I find it, I'll post here.

Joe
> --
> You received this message because you are subscribed to the Google Groups
> "autokey-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to autokey-user...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/autokey-users/85c759b1-6b3e-42ea-a187-a3b1fab4e059n%40googlegroups.com.
>


Little Girl

unread,
Aug 2, 2021, 7:48:04 PM8/2/21
to autoke...@googlegroups.com
Hey there,

JC wrote:

>I have the following code in AutoHotkey and I have no clue of
>whether it's doable in AutoKey.

[SNIP]

You might find this AutoKey wiki page useful:

https://github.com/autokey/autokey/wiki/Mouse-Control

--
Little Girl

There is no spoon.

Josh Chandra

unread,
Aug 2, 2021, 8:40:51 PM8/2/21
to autoke...@googlegroups.com
I did see that but I don't know how to get the exact coordinates of where the mouse currently is in the active window 😕 It'd be awesome if AutoKey could get a WindowSpy-like tool like that which AutoHotkey comes with, which shows both dimensions (on the screen and in the active window).

Little Girl

unread,
Aug 2, 2021, 9:13:08 PM8/2/21
to autoke...@googlegroups.com
Hey there,

Josh Chandra wrote:

>> I did see that but I don't know how to get the exact coordinates
>> of where the mouse currently is in the active window 😕

Instructions for that are on that page, but I guess they could be
positioned better. I'll edit the page.

JC

unread,
Aug 2, 2021, 9:44:32 PM8/2/21
to autokey-users
Oops, I thought that only got the mouse coordinates for the entire screen versus in the active window. Thanks!

Little Girl

unread,
Aug 2, 2021, 10:24:39 PM8/2/21
to autoke...@googlegroups.com
Hey there,

JC wrote:

>Oops, I thought that only got the mouse coordinates for the entire
>screen versus in the active window. Thanks!

Ack, I got that wrong. The script I had provided gives the X and Y
coordinates of the active window. I just found the one that gives the
mouse coordinates and will put that one up. Sorry about that. It will
be fixed in just a moment.

jos...@main.nc.us

unread,
Aug 3, 2021, 8:35:16 AM8/3/21
to autoke...@googlegroups.com
See the new wiki page Elliria just added:

https://github.com/autokey/autokey/wiki/Mouse-Control#get-the-current-mouse-coordinates

If it doesn't answer your question, let us know and she'll probably add
something that will.

Joe
> --
> You received this message because you are subscribed to the Google Groups
> "autokey-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to autokey-user...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/autokey-users/CAMHkQxS6pJsM5dwA9R3bmmvFAA--HU-6N36ETwsVHd2D0LNZZA%40mail.gmail.com.
>


Reply all
Reply to author
Forward
0 new messages