Cue Posted October 2, 2006 Share Posted October 2, 2006 This sounds fairly simple but iam having some difficulty, or maybe iam just being stupid. Is there a way to swap the mouse buttons (Temporarily) in autoit. Link to comment Share on other sites More sharing options...
dabus Posted October 2, 2006 Share Posted October 2, 2006 #include <Misc.au3> $dll = DllOpen("user32.dll") While 1 If _IsPressed(01, $dll) Then MouseClick('right') ElseIf _IsPressed(02, $dll) Then MouseClick('left') ElseIf _IsPressed(04, $dll) Then ExitLoop EndIf WEnd DllClose($dll) ... does not work as I thought... Link to comment Share on other sites More sharing options...
Cue Posted October 2, 2006 Author Share Posted October 2, 2006 Yeah. I had the same problem. It does the right click before the left. the problem is that i cant find a way to disable the mousebutton and not pass it on to the active application. Link to comment Share on other sites More sharing options...
Cue Posted October 2, 2006 Author Share Posted October 2, 2006 Thanks for the attempt BTW Link to comment Share on other sites More sharing options...
BigDod Posted October 2, 2006 Share Posted October 2, 2006 (edited) If you had done a search you would have found this Func SwapMouseButton($mode = 1) DllCall("user32.dll", "int", "SwapMouseButton", "int", $mode) EndFunc Edit - mode = 1 for swapping mode = 0 for returning to normal mode Edited October 2, 2006 by BigDod Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
Xenobiologist Posted October 2, 2006 Share Posted October 2, 2006 Hi, yes u can like BigDod shows, but why? If the user has swapped the left and right mouse buttons in the control panel, then the behaviour of the buttons is different. "Left" and "right" always click those buttons, whether the buttons are swapped or not. The "primary" or "main" button will be the main click, whether or not the buttons are swapped. The "secondary" or "menu" buttons will usually bring up the context menu, whether the buttons are swapped or not So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Cue Posted October 2, 2006 Author Share Posted October 2, 2006 BigDod thanks for that. I actually did do a search but didnt come across that what did you use for you search terms. Hi, th.meger I need this for a Tablet pc so that I can add a small area on the screen to point to then the next point will be a left click instead. Link to comment Share on other sites More sharing options...
Xenobiologist Posted October 2, 2006 Share Posted October 2, 2006 Hi Cue, still not totally clear, but ... nevertheless - go on. So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Cue Posted October 2, 2006 Author Share Posted October 2, 2006 Sorry, I didnt explain very well. I've got a tablet pc and pointing anywhere on the screen performs a right click. To "left" click you have to hold the pen on the screen for a while which is quite annoying. so I'm writing a script with a tray icon that when right clicked on will make the next click a left click. Hope thats understandable. Link to comment Share on other sites More sharing options...
BigDod Posted October 2, 2006 Share Posted October 2, 2006 BigDod thanks for that. I actually did do a search but didnt come across that what did you use for you search terms."swap mouse buttons" Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
Cue Posted October 2, 2006 Author Share Posted October 2, 2006 Thats what I searched for and got alot of threads I skimmed through most that sounded relavent and didt find anything. Nevermind Bizzaro 1 Link to comment Share on other sites More sharing options...
BigDod Posted October 2, 2006 Share Posted October 2, 2006 (edited) Thats what I searched for and got alot of threads I skimmed through most that sounded relavent and didt find anything. NevermindDid you enclose it in quotes as per my post. When I did it I only got two hits one of which was this topic. Edited October 2, 2006 by BigDod Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
Cue Posted October 2, 2006 Author Share Posted October 2, 2006 No, I didnt think of that Link to comment Share on other sites More sharing options...
Cue Posted October 8, 2006 Author Share Posted October 8, 2006 I cant seem to figure out why this simple script doesnt work. It shows some very odd behavior. clicking the system tray swaps the mouse buttons until a left click is performed. if you swap then left click on the tray the system tray menu shows. now the problem is if you click the tray after left clicking on the menu you cant swap the buttons again until you right click even if you exit the script and start it again any idea whats going on. expandcollapse popup#Include <Constants.au3> #Include <Misc.au3> #NoTrayIcon Opt("TrayMenuMode",3) ; Default tray menu items (Script Paused/Exit) will not be shown. TraySetClick(0) $Menuclicked=0 $aboutitem = TrayCreateItem("About")u TrayCreateItem("") $exititem = TrayCreateItem("Exit") TraySetState() While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $TRAY_EVENT_PRIMARYUP SwapMouseButton(1) ;swap buttons TraySetState (4) ;make tray blink while Not _IsPressed(01, "user32.dll") AND $Menuclicked=0 ;wait for left click WEnd SwapMouseButton(0) ;swap back TraySetState (8) ;stop tray blink $Menuclicked=0 Case $msg= $TRAY_EVENT_SECONDARYDOWN $Menuclicked=1 TraySetState (8) ;stop tray blink SwapMouseButton(0) ;swap back ;show tray menu TraySetClick(1) MouseClick("left") TraySetClick(0) Case $msg = $exititem Exit EndSelect WEnd Func SwapMouseButton($mode = 1) DllCall("user32.dll", "int", "SwapMouseButton", "int", $mode) EndFunc Link to comment Share on other sites More sharing options...
GaryFrost Posted October 8, 2006 Share Posted October 8, 2006 (edited) Works fine for me, once the swap is done, use the left click which is now the right click, then it swaps again Edit: had my left and right reversed in the sentence. Edited October 8, 2006 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs  Don't argue with an idiot; people watching may not be able to tell the difference.  Link to comment Share on other sites More sharing options...
Cue Posted October 8, 2006 Author Share Posted October 8, 2006 Figured it out I should have used TRAY_EVENT_SECONDARYUP instead because it performed a PRIMARYUP after i let go. but its still very odd that if you exit the script and start it again it remembers if you didnt press right click Link to comment Share on other sites More sharing options...
GaryFrost Posted October 8, 2006 Share Posted October 8, 2006 Figured it out I should have used TRAY_EVENT_SECONDARYUP instead because it performed a PRIMARYUP after i let go. but its still very odd that if you exit the script and start it again it remembers if you didnt press right clickUsing the dllcall to swap mouse buttons, doesn't just swap the mouse buttons in the script. SciTE for AutoItDirections for Submitting Standard UDFs  Don't argue with an idiot; people watching may not be able to tell the difference.  Link to comment Share on other sites More sharing options...
Cue Posted October 8, 2006 Author Share Posted October 8, 2006 (edited) Works fine for me, once the swap is done, use the left click which is now the right click, then it swaps againHi gafrost. Iam writing this for a tablet pc so pretend you dont have a right click. i wanted to click on this tray, swaps buttons then next left click becomes a right click and swaps back to normal.Edit: added quote to avoid confusion, gafrost types alot faster than his Avatar Edited October 8, 2006 by Cue Link to comment Share on other sites More sharing options...
Cue Posted October 8, 2006 Author Share Posted October 8, 2006 (edited) Using the dllcall to swap mouse buttons, doesn't just swap the mouse buttons in the script.gafrost its hard to keep up with your posts, loltry it with only the left click. it actually swaps them back but it still requires a right click before performing it again. Edited October 8, 2006 by Cue Link to comment Share on other sites More sharing options...
Cue Posted October 8, 2006 Author Share Posted October 8, 2006 (edited) Do this to recreate the problem. use left click only. click on tray, click tray again, now click about. now try clicking the tray to swap again, It doesnt work . Now exit the script and open again now click on tray, It still doesnt work. Kinda odd edit:[ Remember exit using left click only by using ctrl+Break in SciTE for example] Edited October 8, 2006 by Cue 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