Jump to content

repeated mouse clicking


Guest
 Share

Recommended Posts

Hi,

I am trying to advance from basic examples, but cant find my errors. I am using the example from _IsPressed documentation and try to expand on it.

Right now I want to achieve a quick repeated mouse click when the mouse button is pressed.

Here is my example and its not working at all how I expected it to work and after trying and testing cannot find an answer myself:

#include <Misc.au3>
#include <MsgBoxConstants.au3>

Local $hDLL = DllOpen("user32.dll")

While 1
    If _IsPressed("01", $hDLL) Then
        ConsoleWrite("_IsPressed - Mouse Left was pressed." & @CRLF)
      If _IsPressed("01") Then
         MouseClick("left")
         Sleep(50)
      EndIf
        ; Wait until key is released.
      While _IsPressed("01", $hDLL)
         Sleep(250)
      WEnd
      ConsoleWrite("_IsPressed - Mouse Left Key was released." & @CRLF)
   ElseIf _IsPressed("75", $hDLL) Then
      ;MsgBox($MB_SYSTEMMODAL, "_IsPressed", "The F6 Key was pressed, therefore we will close the application.")
      ExitLoop
   EndIf
   Sleep(250)
WEnd

DllClose($hDLL)

I had expected once I press the left mouse button it would click and release and click and release until I release the button.

But its a more or less chaotic click and release for a few times and then it stops.

Thanks for any help

Link to comment
Share on other sites

  • Moderators

@ScriptN00b This looks very similar to your previous post on mouse clicking. So how about explaining just what you're trying to accomplish?

 

                                                      =====In case you missed it, this is a Mod stepping into a thread=====

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

I am trying to learn and understand how to program autoitscript. The goal in this example is pretty clear.

Pressing a mouse button leads to repeated clicks, releasing the mouse button stops it.

And as I am obviously not skilled at it I am asking for some help.

Link to comment
Share on other sites

  • Developers

Well, as you aren't very forthcoming with information and your previous request was game related, I can only assume you simply rephrased your question in a more generic way....  So closed and last warning without consequences. 

*click*

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Jos locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...