Jump to content

Simple question.


lolp1
 Share

Recommended Posts

I'm trying to make a program so while I hold Mouse click left down, it keeps clicking, untill I release. Problem is with what I tried, once I click once, and release, it still keeps clicking, this is wht I have:

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.1.3 (beta)
 Author:         Lolp1

 Script Function:
    Click

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
   
If _IsPressed("01", $dll) Then
      
        Do
            While 1
    Mouseclick("left")
    Wend
    Until Mouseup("left")

        ExitLoop
    EndIf
WEnd
DllClose($dll)

What am I doing wrong:D

Link to comment
Share on other sites

I tried this, but compile error, any advice?

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.1.3 (beta)
 Author:         Lolp1

 Script Function:
    Anti-recoil, Auto-pistol, Bunny hop

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
   
Until NOT  _IsPressed("01", $dll)
Do
    While 1
        Mouseclick("left")
        Wend
   ExitLoop
    EndIf
WEnd
DllClose($dll)
Link to comment
Share on other sites

  • Moderators

Wow, 4 things...

1. A title referencing what your issue is would be great rather than "Simple Question"

2. Always show the error you're having

3. Look at your While/WEnd Loop, right after ExitLoop ... See anything wrong there? Like no matching If to the EndIf statement?

4. Use SciTe, these errors would be known to you.

Edit:

Actually ... Looking at it again

I don't know what the hell you're doing, that's got to be one of the worse copy and paste jobs I've seen... And I'm assuming you're trying not to show what you're actually doing when I say that.

As far as I can tell, this looks like what you're trying to do:

#include <Misc.au3>

$dll = DllOpen("user32.dll")
While 1
    If _IsPressed("01", $dll) Then
        Sleep(100)
        While  _IsPressed("01", $dll)
            Mouseclick("left")
            ExitLoop
        WEnd
            Sleep(100)
    EndIf
    Sleep(10)
WEnd
DllClose($dll)
Edited 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.

Link to comment
Share on other sites

... Ok... so your logic loops are structured wrongly:

#cs ----------------------------------------------------------------------------

AutoIt Version: 3.2.1.3 (beta)
Author:         Lolp1

Script Function:
    Anti-recoil, Auto-pistol, Bunny hop

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
     Do
        Mouseclick("left")
         _IsPressed("01", $dll) ;;An attempt to clear the IsPressed set by the mouse click above
        Sleep(5) ;;Attempt to capture user clicking.
     Until NOT  _IsPressed("01", $dll)
     Sleep(10) ;;Idle
WEnd
DllClose($dll)

#)

Link to comment
Share on other sites

  • Moderators

What you posted here just non-stop clicks wrather the mouse is pressed or not.

Read my edit

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.

Link to comment
Share on other sites

Wow, 4 things...

1. A title referencing what your issue is would be great rather than "Simple Question"

I am trying to make the script so when mouse1 is pressed, it non-stop clicks untill mouse1 is released.

2. Always show the error you're having

I'm not having a complile error, it's just my script is not working the way I intended it to

Edit:

Actually ... Looking at it again

I don't know what the hell you're doing, that's got to be one of the worse copy and paste jobs I've seen... And I'm assuming you're trying not to show what you're actually doing when I say that.

I am confused by this, I am trying to make a "auto-pistol" for a video game. (so I don't have to mouse click manuanly so many times)

This is the code I tried to do that:

#cs ----------------------------------------------------------------------------

AutoIt Version: 3.2.1.3 (beta)
Author:      Lolp1

Script Function:
    Click

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
  
If _IsPressed("01", $dll) Then
      
        Do
            While 1
    Mouseclick("left")
    Wend
    Until Mouseup("left")

        ExitLoop
    EndIf
WEnd
DllClose($dll)

When I run this, when I mouse click it just non-stop mouse clicks untill I close the program, instead of stopinf when I release, thats what I want help with.

Edited by lolp1
Link to comment
Share on other sites

  • Moderators

You stated in post number 3 that you were having a compile error. And my edit waits until you press the left mouse button, then while pressing it sends extra mouseclicks.

If you want to do something different then put in detail what you are trying to do, ie...

1. User presses left mouse button

2. While the user has left mouse button down, send other mouse clicks

3. When user lets up on left mouse button, sleep until it is pressed again.

Edit to your edit:

You have 2 loops Do/While/Wend/Until ... you never exit the While/WEnd

Edited 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.

Link to comment
Share on other sites

  • Moderators

My post in #4 looks like what you are trying to do:

#include <Misc.au3>

$dll = DllOpen("user32.dll")
While 1
    If _IsPressed("01", $dll) Then
        Sleep(100)
        While  _IsPressed("01", $dll)
            Mouseclick("left")
            ExitLoop
        WEnd
        Sleep(100)
    EndIf
    Sleep(10)
WEnd
DllClose($dll)

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.

Link to comment
Share on other sites

And my edit waits until you press the left mouse button, then while pressing it sends extra mouseclicks.

It did not send any extra mouse clicks, it was just as if it were normal.

The compile error I get on post # 3 is:

Error: "Untill" statement with no matching do statement.

What I want to do is:

1) When mouse1 is pressed, send non-stop mouse clicks (looped)

2) When user lets up, the mouse clicks stop completley.

EDIT:

#include <Misc.au3>

$dll = DllOpen("user32.dll")
While 1
    If _IsPressed("01", $dll) Then
        Sleep(100)
        While  _IsPressed("01", $dll)
            Mouseclick("left")
            ExitLoop
        WEnd
        Sleep(100)
    EndIf
    Sleep(10)
WEnd
DllClose($dll)

This doesnt send the extra mouse clicks, it's as if no program were running.

Edited by lolp1
Link to comment
Share on other sites

1. MouseUp doesn't check if a mousebutton is down, it performs a mouse up event !

I already told you that so why do you continue to use it ? Not that it matters (see next point).

2. You put a endless loop which have no way to escape inside the so-called "checking".

3. Putting a tiny Sleep() in loops is always a good idea, unless you want to dedicate the entire

CPU to your script.

Do
    While 1
        Mouseclick("left")
    Wend
Until Mouseup("left")
Link to comment
Share on other sites

Nothing posted in this topic has worked for me.

Let me refresh what I am trying to do:

While mouse1 is pressed (held down) it sends mouse clicks on a loop, when Mouse1 is released, it stops the clicking, I've tried all the code above and no luck. Clearly I am missing something, and since this is the help forums, I;m looking to see what I missed.

Link to comment
Share on other sites

You are rude for a moderator. This is the help section, I clearly am not understanding the code posted, and none of it has worked for me.

So I ask for further explination, and I get told to go away?...

All I am asking is how to get this to work:

1) While mouse1 is pressed, send non-stop mouse clicks

2) When the mouse is released, the mouse clicks are stopped untill the mouse1 is pressed and held agian.

I tried this code, and it did not work, asking why, and how to fix it:

#cs ----------------------------------------------------------------------------

AutoIt Version: 3.2.1.3 (beta)
Author:      Lolp1

Script Function:
    Click

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
  
If _IsPressed("01", $dll) Then
      
        Do
            While 1
    Mouseclick("left")
    Wend
    Until Until NOT  _IsPressed("01", $dll)

        ExitLoop
    EndIf
WEnd
DllClose($dll)
Link to comment
Share on other sites

*shakes head*

you are not qualified to make this statement...

there is no other solution.

go away.

Lar.

haha rofll :)!

Larry ftw.

Edited by aceloc

[quote name='AceLoc']I gots new sunglasses there cool.[/quote]

Link to comment
Share on other sites

Ok, I do appolgize for beeing a bit ignorant in this thread.

I've tried everything in here now so far, and closes to what I am looking for is:

#include <Misc.au3>

$dll = DllOpen("user32.dll")
While 1
    If _IsPressed("01", $dll) Then
        Sleep(100)
        While  _IsPressed("01", $dll)
            Mouseclick("left")

            ExitLoop
        WEnd
            Sleep(100)
    EndIf
    Sleep(10)
WEnd
DllClose($dll)

Problem is, it only does one extrs mouse click when held, I need to do non-stop. (Untill mouse1 is released) how would I do that?

Link to comment
Share on other sites

Ok, I do appolgize for beeing a bit ignorant in this thread.

I've tried everything in here now so far, and closes to what I am looking for is:

#include <Misc.au3>

$dll = DllOpen("user32.dll")
While 1
    If _IsPressed("01", $dll) Then
        Sleep(100)
        While  _IsPressed("01", $dll)
            Mouseclick("left")

            ExitLoop
        WEnd
        Sleep(100)
    EndIf
    Sleep(10)
WEnd
DllClose($dll)

Problem is, it only does one extrs mouse click when held, I need to do non-stop. (Untill mouse1 is released) how would I do that?

I don't know if the simulated left click will get through while you are holding down the real left click button, but... Take the ExitLoop out and put a sleep there, and at least the logic will look right:

#include <Misc.au3>

$dll = DllOpen("user32.dll")
While 1
    If _IsPressed("01", $dll) Then
        While  _IsPressed("01", $dll)
            Mouseclick("left")
            Sleep(100)
        WEnd
    EndIf
    Sleep(10)
WEnd

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

PsaltyDS, the-man-who-quotes-everything : it doesn't work. Either he has to accept

Larry's method or he should play like it's supposed to be played, and stop acting, in

my opinion, like a retard who can't play by himself. If he infact is retarded then I can

understand why he need such a script.. no pun intended.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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