Sardith Posted July 13, 2006 Posted July 13, 2006 (edited) expandcollapse popupGlobal $Paused = 0 HotKeySet("{F2}", "wp") $i = 0 While 1 If $Paused = 1 Then If _IsPressed(0x02) Then If _IsPressed(0x01) Then sleep(15) MsgBox(4096, "Test", "Works") EndIf EndIf EndIf Wend Func wp() If $Paused = 0 Then $Paused = 1 Else $Paused = 0 EndIf EndFunc Func _IsPressed($hexKey) Local $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey) If Not @error And BitAND($ar[0], 0x8000) = 0x8000 Then Return True Else Return False EndIf EndFunc #cs 01 Left mouse button 02 Right mouse button 04 Middle mouse button (three-button mouse) 05 Windows 2000/XP: X1 mouse button 06 Windows 2000/XP: X2 mouse button 08 BACKSPACE key 09 TAB key 0C CLEAR key 0D ENTER key 10 SHIFT key 11 CTRL key 12 ALT key 13 PAUSE key 14 CAPS LOCK key 1B ESC key 20 SPACEBAR 21 PAGE UP key 22 PAGE DOWN key 23 END key 24 HOME key 25 LEFT ARROW key 26 UP ARROW key 27 RIGHT ARROW key 28 DOWN ARROW key 29 SELECT key 2A PRINT key 2B EXECUTE key 2C PRINT SCREEN key 2D INS key 2E DEL key 30 0 key 31 1 key 32 2 key 33 3 key 34 4 key 35 5 key 36 6 key 37 7 key 38 8 key 39 9 key 41 A key 42 B key 43 C key 44 D key 45 E key 46 F key 47 G key 48 H key 49 I key 4A J key 4B K key 4C L key 4D M key 4E N key 4F O key 50 P key 51 Q key 52 R key 53 S key 54 T key 55 U key 56 V key 57 W key 58 X key 59 Y key 5A Z key 5B Left Windows key 5C Right Windows key 60 Numeric keypad 0 key 61 Numeric keypad 1 key 62 Numeric keypad 2 key 63 Numeric keypad 3 key 64 Numeric keypad 4 key 65 Numeric keypad 5 key 66 Numeric keypad 6 key 67 Numeric keypad 7 key 68 Numeric keypad 8 key 69 Numeric keypad 9 key 6A Multiply key 6B Add key 6C Separator key 6D Subtract key 6E Decimal key 6F Divide key 70 F1 key 71 F2 key 72 F3 key 73 F4 key 74 F5 key 75 F6 key 76 F7 key 77 F8 key 78 F9 key 79 F10 key 7A F11 key 7B F12 key 7C-7F F13 key - F16 key 80H-87H F17 key - F24 key 90 NUM LOCK key 91 SCROLL LOCK key A0 Left SHIFT key A1 Right SHIFT key A2 Left CONTROL key A3 Right CONTROL key A4 Left MENU key A5 Right MENU key #ce What Im trying to have it do is, if the right mouse button is pushed, it will then wait till the left is pushed. After the left is pushed it will display a msgbox. So it's linked events, if rightclick isn't pressed befor the leftclick then it won't display the msgbox. Any help on getting this to work would be great. It will work up till the second ispressed. I've put a message box between the right mouse and the left and it will display. So it's the second ispressed thats giving me the problems. Edited July 13, 2006 by Sardith [font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]
NELyon Posted July 13, 2006 Posted July 13, 2006 it looks like that thing isn't commented. I think you should just remove it.
Nomad Posted July 13, 2006 Posted July 13, 2006 #include <Misc.au3> While 1 If _IsPressed(0x02) Then If _IsPressed(0x01) Then sleep(15) MsgBox(4096, "Test", "Works") EndIf EndIf Wend Nomad
Sardith Posted July 13, 2006 Author Posted July 13, 2006 Doesn't work.. [font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]
Nomad Posted July 13, 2006 Posted July 13, 2006 (edited) Doesn't work..Does for me, so then there must be some other issue. Are you using beta? Did you do a direct copy and paste of the code posted?However, it works anytime both mouse buttons are pressed. If that's what you mean then I'd have to redo the code to get that. But if this isn't working at all, then there's definately a problem somewhere. Edited July 13, 2006 by Nomad
Sardith Posted July 13, 2006 Author Posted July 13, 2006 Im using Beta. And it's a direct copy of what you gave me. [font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]
Moderators SmOke_N Posted July 13, 2006 Moderators Posted July 13, 2006 (edited) Doesn't work..God I can't stand that... No Thanks for trying, no Hmmm, nothing but "Doesn't work..." blah! While 1 While _IsPressed('02') If _IsPressed('01') Then ; Do Something Sleep(10) WEnd Sleep(10) WEndoÝ÷ ØGb´vßÝ6w÷M·õ8b²h Ü(®F޶׫jëh×6#include <Misc.au3> Global $iKeepTrack While 1 If _IsPressed('02') Then $iKeepTrack = Not $iKeepTrack While $iKeepTrack If _IsPressed('01') Then MsgBox(0, '', '') $iKeepTrack = Not $iKeepTrack EndIf Sleep(10) WEnd EndIf Sleep(10) WEnd Edited July 13, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Nomad Posted July 13, 2006 Posted July 13, 2006 (edited) #include <Misc.au3> While 1 While (_IsPressed(0x01) and not _IsPressed(0x02)) sleep(15) If _IsPressed(0x02) Then MsgBox(4096, "Test", "Works") EndIf WEnd Wend Try that, Nomad Edit: Smoke's way should work too, but you'll need to switch the hex codes for it to start with the left mouse button. Edited July 13, 2006 by Nomad
Sardith Posted July 13, 2006 Author Posted July 13, 2006 (edited) Global $rightclicked = 0 While 1 If $rightclicked = 0 And _IsPressed(0x02)Then $rightclicked = 1 EndIf If $rightclicked = 1 And _IsPressed(0x01) Then $rightclicked = 0 SoundPlay(@WindowsDir & "\media\tada.wav", 1) EndIf Sleep(10) WEnd That works, thanks shynd. Need a variable. Edited July 13, 2006 by Sardith [font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]
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