mach42 Posted December 25, 2009 Share Posted December 25, 2009 (edited) First off this is for a future script, but I'd like to know my options and limitations.I've been using a Logitech 3 button trackball for 13 years ('96). I liked the programmable middle button for DRAG/LOCK. I have no use of fingers so I can not hold the left mouse button down and drag photos, windows, etc around. The trackball is a PS2 type which puts me at a great disadvantage upgrading computers.In November my XP computer went belly up. I was looking forward to getting a new computer with bunches more power. The first thing I did was check if USB was required (not so on a few models, but I was going for the quad core 64 bit unit). Then I looked to see what they had in trackballs. They had none with the right ergonomics and button program-ability. I got a PS2 to USB converter and that almost worked. Yes, I brought the new computer home.The usual left and right buttons worked, but once I installed the MouseWare program to enable the DRAG/LOCK the computer had to reboot to finalize the installation. And once rebooted, the computer acted like nothing had been going on...no new hardware, no new driver, no MouseWare. I tried configuring the thing to run in XP compatibility mode. No!I packed the computer up and returned it.I tried putting a script together to use leftmouse down, but as I recall, it just locked the computer up. I think I was using a hot key combo.Now, some people have said Kensington Expert Mouse will work, but Googling the subject you find a lot of people who had problems even on Vista and customer support was a joke (from my experience it was a stupid joke, better to have no support than stupid). Perhaps this is related to individual computer specs.So, there is my story. My requirements/questions are the following:Hot Key combo that works across several Windows versions. Windows 7 in particular.32 bit vs. 64 bit...it that a problem? Could it work on a Mac?Is left mouse down the best way to do this?CPU load, is this going to slow the computer?On/off keystrokes or UI to start/release Drag/Lock.If mousedown is not the best way, what would be best? I can try working on the script on this machine and maybe post a script for critical review, but I can not promise much beyond the simple scripts.I did get my old machine patched, but its just a matter of time now.Thanks Edited December 25, 2009 by mach42 Link to comment Share on other sites More sharing options...
mach42 Posted January 18, 2010 Author Share Posted January 18, 2010 HotKeySet("{F5}", "_QuitApp") HotKeySet ("{F3}", "Dragstuff") while 1 Sleep(2000) Wend Func Dragstuff() MouseDown("left") EndFunc Func _QuitApp() Exit EndFunc -------------- Ok, is this the best I could do? Can anyone comment on system resources used and/or 64 bit OS compatibility in Windows 7 ? Link to comment Share on other sites More sharing options...
james3mg Posted January 18, 2010 Share Posted January 18, 2010 (edited) First, x64 shouldn't be a problem- AutoIt can be compiled in 32-bit (which runs on 32-bit systems or 64-bit systems), or in native 64-bit (which only runs on 64-bit systems). Next, AutoIt does not, and will not, work on a Mac OS, but if you have Windows installed on a Mac computer, it will run on Windows, no problem. (I wasn't sure exactly what you might mean by, "Mac"). Finally, others may know of a better way than MouseDown, but it seems to me that method would work fine. However, I don't think you really want to exit the script when you press F5- you just want to release the mouse button, right? If you exited the script, your F3 button wouldn't work again until you started the script again. Instead, try MouseUp("left") instead of Exit. This should be a very lightweight script- I can't imagine it would hurt your system resources at all. It should also work on any version of Windows higher than Windows ME (anything NT-based, such as 2000, XP, Vista and 7) One suggestion (I'm not sure what setup you're used to); if you only wanted a single key to toggle a left click on/off, try using a variable:Global $ClickState=0 HotKeySet ("{F3}", "ClickToggle") While 1 Sleep(500) WEnd Func ClickToggle() If $ClickState=0 Then MouseDown("left") Else MouseUp("left") EndIf $ClickState=NOT $ClickState EndFunc Edited January 18, 2010 by james3mg "There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110 Link to comment Share on other sites More sharing options...
james3mg Posted January 18, 2010 Share Posted January 18, 2010 (edited) Rereading your original post, I think this may be more like what you're looking for:#include <Misc.au3> Global $hdll=DllOpen("user32.dll");open the DLL used in _IsPressed so that it doesn't have to open and close the dll every time it runs a check (makes it a much lighter-weight program) Global $ClickState=0;0 indicates left mouse button is "up", 1 indicates left mouse button is "down". While 1 Sleep(15);decrease this number if it's "missing" middle-clicks...this means that it will only check to see if the middle button is pressed once every 15 ms. If _IsPressed("04",$hdll)=1 Then;if middle mouse button is pressed, then: If $ClickState=0 Then;if left mouse button is up, then MouseDown("left");press the left mouse button Else;if left mouse button is down, then MouseUp("left");release the left mouse button EndIf $ClickState=NOT $ClickState;flip 1 to a 0 or 0 to a 1 in $ClickState, so our script can keep track of the new state of the left mouse button Do;now wait until the user releases the middle button, or it will constantly be toggling left-click on/off while they hold the middle button Sleep(15) Until _IsPressed("04",$hdll)=0 EndIf WEndWith this script, you get the behavior I think you're used to; middle-click of the mouse togges a left click hold on/off. This script takes less than 2 MB of RAM (which is nothing), and only took a fraction of a percent of processor power on my machine (which is 32-bit Windows 7, around a year old, and nothing very impressive). You can play with the two Sleep() values if you want to improve performance or reduce system impact, but it seemed very reliable and lightweight at these settings when I tried it out. Edit: added comments to code so you could figure out how this script works...naturally, you can delete the semicolon in each line and everything after it if you just want the pure, clean code. Edited January 18, 2010 by james3mg "There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110 Link to comment Share on other sites More sharing options...
mach42 Posted January 18, 2010 Author Share Posted January 18, 2010 You are correct. I wouldn't want to exit the program as I wrote it. I think that briefly even crossed my mind while writing it. And yes, I was thinking about "Mac" as in that "other" OS, but I can understand the logic of it not working in "Mac" world. Your script is a bit beyond me. Guess I'll study it a while. Thanks! 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