Jump to content
Sign in to follow this  
silv3rmind

XButton click and window below cursor

Recommended Posts

silv3rmind

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

Share this post


Link to post
Share on other sites
FireFox

@silv3rmind

welcome to autoit forum :)

Use helpfile (F1 in SciTE) and try ControlClick

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
silv3rmind

@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

Share this post


Link to post
Share on other sites
Richard Robertson

_IsPressed doesn't capture key presses. It just lets you know something is being pressed.

Edited by Richard Robertson

Share this post


Link to post
Share on other sites
silv3rmind

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

Share this post


Link to post
Share on other sites
FireFox

@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.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
silv3rmind

@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 ^^

Share this post


Link to post
Share on other sites
silv3rmind

Dammit, no can do :) forgot that with the _MouseSetOnEvent(), the click is caught and doesn't pass through for _IsPressed to detect which one was clicked...

Share this post


Link to post
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
Sign in to follow this  

×