Sign in to follow this  
Followers 0
kaashoofd

hotkeyset with mouse?

6 posts in this topic

I've got this problem, which the title says pretty much.

I want to get a hotkeyset on my right mouse button, on each click.

I've read some answers to this question, but I don't think that ispressed will do, because, I dunno why but it doesn't at all.

I just want this instant change for a variable, and this ispressed isn't instant (I think?) but it waits until it reaches that part of the script.

But my question is, is there a way of putting mouseclick in hotkeyset or isn't there? Seems really weird to me if there wouldn't be one :/

Share this post


Link to post
Share on other sites



If your script doesn't have an idle loop it usually returns to, then use AdlibRegister to call a function every so many ms. (this is how fast the script will respond to the click) then at the top of the function use _IsPressed to decide if RMB is pressed and if not, return without doing anything.

There will be a small response time, but there is no such thing as instant when a script has to react to something.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

kaashoofd,

This might be what you are looking for. ;)

M23

Edit: Welcome to the AutoIt forum too! :)

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

@ Tvern

My script does have aj idle loop it usually returns to :)

@ Melba

I don't really know what that does, but i don't want the normal mouseclick to be gone.

I want the mouseclick AND something else to happen.

But isn't there just a button like {ESC} for hotkeyset but then something like {rmb}?

edit: I'm also not looking for rmb down or rmb up, but just a click.

Edited by kaashoofd

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

if your refering to click on mouse under hotkey or under _IsPressed

youl need MouseClick or ControlClick form the help file

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

@ Tvern

My script does have aj idle loop it usually returns to :)

Then _Ispressed seems like a logical choice. Keep in mind that this might start spamming the function while you keep the button down, so you might want to use a solution that stops the function from running more then once per mouseclick like these:

This version stops the entire script while the right mouse is down.

#include <misc.au3>
Global $DLLUser32 = DllOpen("User32.dll")

While 1
    If _IsPressed("02", $DLLUser32) Then _Function()
    Sleep(20)
WEnd

Func _Function()
    ConsoleWrite("This is some text" & @CRLF)
    While _IsPressed("02",$DLLUser32)
        Sleep(20)
    WEnd
EndFunc

This version allows the rest of the script to keep running.

#include <misc.au3>
Global $fMouseDown, $DLLUser32 = DllOpen("User32.dll")

While 1
    If _IsPressed("02", $DLLUser32) Then
        If Not $fMouseDown Then
            _Function()
            $fMouseDown = True
        EndIf
    Else
        $fMouseDown = False
    EndIf
    Sleep(20)
WEnd

Func _Function()
    ConsoleWrite("This is some text" & @CRLF)
EndFunc

How responsive they are depends on how fast your idle loop is, and if the script spends a lot of time in functions, but usually it'll be fast enough for any common application.

The topic Melba23 linked will do exactly what you want too, but I thought I'd at least show you an laternative.

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  
Followers 0