T3k Posted June 26, 2007 Share Posted June 26, 2007 Is there a way to do the equivalent of hotkeyset() but use mouse buttons? e.g. when i right click a certain function is run? Thanks! T3k Link to comment Share on other sites More sharing options...
Toady Posted June 26, 2007 Share Posted June 26, 2007 _IsPressed(1) ;left mouse _IsPressed(2) ;right mouse _IsPressed(4) ;middle mouse www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding Link to comment Share on other sites More sharing options...
qazwsx Posted June 26, 2007 Share Posted June 26, 2007 _IsPressed(1) ;left mouse _IsPressed(2) ;right mouse _IsPressed(4) ;middle mouse _Ispressed(1) is not working for me wat am i doin wrong? Code:CODE_IsPressed(1) $var = MouseGetPos () MsgBox (0, $var[0], $var[1]) Link to comment Share on other sites More sharing options...
Toady Posted June 26, 2007 Share Posted June 26, 2007 (edited) #include <misc.au3> sleep(100) while 1 if _IsPressed(1) Then Local $var = MouseGetPos () MsgBox (0, $var[0], $var[1]) Exit Endif sleep(10) Wend gotta use it in a loop.. Edited June 26, 2007 by Toady www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding Link to comment Share on other sites More sharing options...
qazwsx Posted June 26, 2007 Share Posted June 26, 2007 ohh thx Link to comment Share on other sites More sharing options...
T3k Posted June 27, 2007 Author Share Posted June 27, 2007 (edited) The problem with that is I want to do something like this: $key="{ENTER}" $count = 0 HotKeySet($key, "function") Func function() HotKeySet($key, "dummy") While _IsPressed('0D') ;; OD is hex for {ENTER} $count += 1 WEnd HotKeySet($key, "function") EndFunc Func dummy() EndFunc Sleep(10000) MsgBox(0, 0, $count) So that while you hold the key something happens, but the key itself doesnt get sent. Any thoughts? Edited June 27, 2007 by T3k Link to comment Share on other sites More sharing options...
Toady Posted June 27, 2007 Share Posted June 27, 2007 So that while you hold the key something happens, but the key itself doesnt get sent. Any thoughts? You are on the right track, yet.. #include <misc.au3> $key="{ENTER}" $count = 0 HotKeySet($key, "function") Sleep(10000) MsgBox(0, 0, $count) Func function() HotKeySet(@HotKeyPressed, "dummy") ;do it this way so multiple hotkeys can use this function While _IsPressed('0D') ;; OD is hex for {ENTER} Sleep(10) ;do something while key is held down.. WEnd $count += 1 ;get exactly the number of times key was pressed HotKeySet(@HotKeyPressed, "function") EndFunc Func dummy() EndFunc Did this answer your question? Or am I missing what you are asking? www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding Link to comment Share on other sites More sharing options...
T3k Posted June 27, 2007 Author Share Posted June 27, 2007 You are on the right track, yet.. #include <misc.au3> $key="{ENTER}" $count = 0 HotKeySet($key, "function") Sleep(10000) MsgBox(0, 0, $count) Func function() HotKeySet(@HotKeyPressed, "dummy") ;do it this way so multiple hotkeys can use this function While _IsPressed('0D') ;; OD is hex for {ENTER} Sleep(10) ;do something while key is held down.. WEnd $count += 1 ;get exactly the number of times key was pressed HotKeySet(@HotKeyPressed, "function") EndFunc Func dummy() EndFunc Did this answer your question? Or am I missing what you are asking? What I meant to ask was, how do you do that, but with a mouse button instead of enter, since you can't HotKeySet a mouse button to dummy? Link to comment Share on other sites More sharing options...
Mast3rpyr0 Posted June 27, 2007 Share Posted June 27, 2007 i think that was answered back in the first post... #Include <Misc.au3> $key="{ENTER}" $count = 0 HotKeySet($key, "function") Func function() While _IsPressed('0D') ;; OD is hex for {ENTER} $count += 1 WEnd EndFunc Sleep(10000) MsgBox(0, "Count", $count) Just incase none of the above worked heres this. My UDF's : _INetUpdateCheck() My Programs : GameLauncher vAlpha, InfoCrypt, WindowDesigner, ScreenCap, DailyRemindersPick3GeneratorBackupUtility! Other : Bored? Click Here! Link to comment Share on other sites More sharing options...
T3k Posted June 27, 2007 Author Share Posted June 27, 2007 (edited) i think that was answered back in the first post...It wasnt. Maybe I'm not explaining well enough. I want it so that while the user holds down, say, the right mouse button the script does something, and stops when the button is released. But while it's doing that, the right click shouldn't go through to the OS (which is what HotKeySet($key, "dummy") does, but not for mouse buttons). Did that make sense? Edited June 27, 2007 by T3k Link to comment Share on other sites More sharing options...
Jonatas Posted November 12, 2019 Share Posted November 12, 2019 Sorry to relive the topic, but it seems that the doubt has not been resolved and this may be the doubt of others. Here's a solution: #include <MsgBoxConstants.au3> #include <Misc.au3> Local $n = 0 ;When you press "END" key the process ends HotKeySet("{END}", "_Terminate") Func _Terminate() Exit EndFunc ;When pressing "q" key displays count quantity HotKeySet("q", "_InfoBox") Func _InfoBox() MsgBox(0,"",$n) EndFunc ;While holding down the left mouse button add up While 1 While _IsPressed(1) $n = $n + 1 Sleep(500) WEnd Sleep(100) WEnd Assembler 1 Link to comment Share on other sites More sharing options...
Earthshine Posted November 13, 2019 Share Posted November 13, 2019 Please do not resurrect old threads. Nobody cares at this point seadoggie01, Nine and Assembler 2 1 My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Assembler Posted May 2, 2021 Share Posted May 2, 2021 On 11/13/2019 at 12:18 PM, Earthshine said: Please do not resurrect old threads. Nobody cares at this point I do care. It would be kind to not blame others for answering an old question precisely. Even though you can't imagine that someone could be interested in the answer to this question, it doesn't mean that his assumption is wrong. His answer saved me some time and is in a good readable format. So thanks to @Jonatas! 🤝 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 2, 2021 Moderators Share Posted May 2, 2021 Assembler, Welcome to the AutoIt forums. As a general rule we discourage necroposting as the language has changed so much over the years that it is likely that the requested functionality has already been incorporated and/or the previously posted code will almost certainly not run in the current version of AutoIt without modification. But I am delighted to see that you found this particular post useful. M23 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: Spoiler 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 Link to comment Share on other sites More sharing options...
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