Guest Thermos2000 Posted January 25, 2005 Share Posted January 25, 2005 (edited) I've pasted the _IsPressed function into my script, and then i add the very simple code: While 1 If _IsPressed('01') Then Send("a") Sleep(100) EndIf WEnd to perform a task repeatedly as i hold down the mouse. of course, after i get it to work i will change the Send("a") to do what i want, this is just to test. So i load the script with wordpad already loaded. i hold down my mouse in wordpad, and it continually types a a a a a, and then stops when i let go. this is exactly what i want. the only problem is that if i try to hold down my mouse a second time, it stops working. im not sure why; isn't the loop infinite? why does it stop working after the first time i hold down and then release my mouse button? thanks guys. EDIT: i've now noticed some strange behavior. if i hold down my mouse in wordpad, it works the first time and then doesnt, as i stated before. but after it stops working in wordpad, i can hold it down on my desktop and it works (toggling between all the icons that start with the letter A). the same behavior occurs on my desktop, after the first time it stops working. but then i am able to perform the loop on wordpad once again. another strange thing ive noticed is that it doesnt work in some windows, such as Notepad (rather than wordpad) or the address bar on MSIE. Strange. Edited January 25, 2005 by Thermos2000 Link to comment Share on other sites More sharing options...
petrojelly Posted January 25, 2005 Share Posted January 25, 2005 you can't type in notepad while holding mouse Link to comment Share on other sites More sharing options...
therks Posted January 25, 2005 Share Posted January 25, 2005 (edited) Try something besides Send(). ToolTip works fine #include <IsPressed.au3> While 1 If _IsPressed('LBUTTON') Then ToolTip('click') EndIf WEnd Edit: And actually, even your code works fine for me. Even in this textarea. Edited January 25, 2005 by Saunders My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
crushinator Posted January 15, 2006 Share Posted January 15, 2006 Hello,Your code to repeat keypress "a" while "Left Mouse button" is clicked worked well for me as well.However, how can you get the desired keypress "a" functionality WITHOUT passing the "Left Mouse button" through to the underlying program also? In other words, how can you make _IsPressed intercept the mouse-click before it is processed by the underlying program? If it were a keystroke, I could use HotKeySet function, but that doesn't work with mouse-click buttons (does it?). Right now I must instead use the AutoHotKey program to map my Middle Click button into a more complicated script action, but then I lose many of the AutoIt functions and syntax. Link to comment Share on other sites More sharing options...
tittenkalle Posted July 15, 2006 Share Posted July 15, 2006 Hello,Your code to repeat keypress "a" while "Left Mouse button" is clicked worked well for me as well.However, how can you get the desired keypress "a" functionality WITHOUT passing the "Left Mouse button" through to the underlying program also? In other words, how can you make _IsPressed intercept the mouse-click before it is processed by the underlying program? If it were a keystroke, I could use HotKeySet function, but that doesn't work with mouse-click buttons (does it?). Right now I must instead use the AutoHotKey program to map my Middle Click button into a more complicated script action, but then I lose many of the AutoIt functions and syntax.Hi,how do I catch a click and NOT send ist to the application?Until now I use the code like postet above.Greetingstk 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