Jump to content

Recommended Posts

Posted

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 :/

Posted

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.

  • Moderators
Posted (edited)

kaashoofd,

This might be what you are looking for. ;)

M23

Edit: Welcome to the AutoIt forum too! :)

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

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
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)

  Reveal hidden contents


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.

 
Posted

  On 2/17/2011 at 6:51 PM, 'kaashoofd said:

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...