Jump to content

XButton click and window below cursor


Recommended Posts

Hi everyone, I'm used to some scripting with AHK and now I'm migrating from it to AutoIt3 ^^ the transition is going smooth but I want do convert some things from my previous scripts and one of them is to be able to minimize the window below my mouse cursor when i click the XButton2 on it. I've been searching around the forum and on google but didn't find anything to help me, the thing is, if i set up a hotkey with HotKeySet the input doesn't pass through but since the XButtons can't be detected with HotKeySet (at least, I haven't found a way to do it) I'm using _IsPressed (0x05) to catch the click but the click passes through to the window I click on, which can be annoying if it is a browser window or an Explorer window. Also, I haven't found a way to detect the window currently below my mouse cursor (detect it like AU3Info does or similar), for now I'm partially taking advantage of the "through click" and minimizing the active window since it gets activated when I click the button, but that's not quite what I wanted.

Currently this is what I have:

While 1

...

;~ XButton2

If _IsPressed (0x05) Then

WinSetState("[ACTIVE]", "", @SW_MINIMIZE)

EndIf

...

WEnd

This is kind of what i began with, I've been playing around with some more commands and external functions I found around but with no success. Just want some tips on it, if anyone has them XD

Thanks in advance,

Nuno Gomes

Link to comment
Share on other sites

@silv3rmind

welcome to autoit forum :think:

Use helpfile (F1 in SciTE) and try ControlClick

Cheers, FireFox.

Hi :lmao: and thanks for the fast reply =D yeah I've been using SciTE to go to the help quick and easy and a lot more of its functionalities, one of the reasons for me to switch to autoit.

Hmm, I've looked at ControlClick previously but not helpful for me, at least I can't see how :) first of all I need to find out which window is below my mouse cursor, that's my biggest issue, can only get it if is the active one, after finding out that there's no problem, just the one of having the click passing through, but that I can live with (for now at least lol)

Thanks,

Nuno

Link to comment
Share on other sites

Problem partially solved.

Dug up some more in the forum and found _MouseSetOnEvent_UDF from MrCreatoR ^^ it does what I want neatly =D just have to find how to check which button was click XButton1 or XButton2. I think I saw on another UDF a way to check it through the HiWord that one of the DLL calls has, I'll try to find it again.

Now could someone give me an idea on how to get the window below the mouse cursor?

Thank you,

Nuno Gomes

Link to comment
Share on other sites

@silverman

You can check mouse buttons to this way :

#Include <IsPressed_UDF.au3> ; -> =Misc for IsPressed

While 1
If _IsPressed('01') Then
TrayTip('Mouse', 'Left Mouse', 0, 1)
ElseIf _IsPressed('02') Then
TrayTip('Mouse', 'Right Mouse', 0, 1)
ElseIf _IsPressed('03') Then
TrayTip('Mouse', 'Middle Mouse', 0, 1)
EndIf ;you can add button 5,6
WEnd

Not tested

Cheers, FireFox.

Link to comment
Share on other sites

@silverman

You can check mouse buttons to this way :

#Include <IsPressed_UDF.au3> ; -> =Misc for IsPressed

While 1
If _IsPressed('01') Then
TrayTip('Mouse', 'Left Mouse', 0, 1)
ElseIf _IsPressed('02') Then
TrayTip('Mouse', 'Right Mouse', 0, 1)
ElseIf _IsPressed('03') Then
TrayTip('Mouse', 'Middle Mouse', 0, 1)
EndIf ;you can add button 5,6
WEnd

Not tested

Cheers, FireFox.

Duh :lmao: I had already the answer myself on my first post for detecting those two alone :) I've been doing lots of stuff at the same time and since I still getting used to autoit I totally forgot about the _IsPressed XD I just need to add them to what I have now lol thanks for the tip again ^^
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...