kaashoofd Posted February 17, 2011 Posted February 17, 2011 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 :/
Tvern Posted February 17, 2011 Posted February 17, 2011 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 Melba23 Posted February 17, 2011 Moderators Posted February 17, 2011 (edited) kaashoofd, This might be what you are looking for. M23 Edit: Welcome to the AutoIt forum too! Edited February 17, 2011 by Melba23 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 ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
kaashoofd Posted February 17, 2011 Author Posted February 17, 2011 (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 February 17, 2011 by kaashoofd
bogQ Posted February 17, 2011 Posted February 17, 2011 (edited) if your refering to click on mouse under hotkey or under _IsPressed youl need MouseClick or ControlClick form the help file Edited February 17, 2011 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) Reveal hidden contents 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.
Tvern Posted February 17, 2011 Posted February 17, 2011 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now