Sign in to follow this  
Followers 0
AngelSL

How do I trigger code when button is clicked?

9 posts in this topic

#1 ·  Posted (edited)

So I've been making this autoclicker with the help of AutoBuilder.

#include <GUIConstants.au3>
; copyright AngelSL @ hwtee2005@gmail.com or angelsl@k9-net.org
; thanks to AutoIt3 and Koda
; thanks to the forum community for helping me (even if they didn't)
; code start


$Form1_1 = GUICreate("AngelSL's PQ-In", 331, 131, 367, 568)
$Button1 = GUICtrlCreateButton("Start Autoclicking", 70, 72, 100, 25, 0)
$Group1 = GUICtrlCreateGroup("Autoclicker", 8, 0, 313, 105)
$Input1 = GUICtrlCreateInput("", 112, 48, 193, 21)
$Label1 = GUICtrlCreateLabel("Autoclicker Speed", 16, 48, 91, 17)
$Progress1 = GUICtrlCreateProgress(17, 16, 295, 25)
GUICtrlSetData(-1, 0)
$Button2 = GUICtrlCreateButton("Stop Autoclicking", 170, 72, 100, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$MenuItem1 = GUICtrlCreateMenu("&Start Clicking")
$MenuItem3 = GUICtrlCreateMenu("S&top Clicking")
$MenuItem2 = GUICtrlCreateMenu("&Exit")
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Now my problem is, I cant seem to find a way to make it trigger code when it is clicked.

Also, I am trying to make it click unlimitedly, but there is no way.

Also, I am trying to make it click where the cursor is, but the documentation doesn't light anything.

Also, there is no way to make it stop clicking, as far as the documentation goes.

Also, is there a way to make those progress bars that go like

|

-|

--|

(- = whitespace)

(continuously)

Instead of

|

||

|||?

Thanks.

Edited by AngelSL

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I don't know if this is what u want

#include <GUIConstants.au3>

#include <Misc.au3>    ; important
$dll = DllOpen("user32.dll")

$Form1_1 = GUICreate("AngelSL's PQ-In", 331, 131)
$Button1 = GUICtrlCreateButton("Start Autoclicking", 70, 72, 100, 25, 0)
$Group1 = GUICtrlCreateGroup("Autoclicker", 8, 0, 313, 105)
$Input1 = GUICtrlCreateInput("", 112, 48, 193, 21)
$Label1 = GUICtrlCreateLabel("Autoclicker Speed", 16, 48, 91, 17)
$Progress1 = GUICtrlCreateProgress(17, 16, 295, 25)
GUICtrlSetData(-1, 0)
$Button2 = GUICtrlCreateButton("Stop Autoclicking", 170, 72, 100, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$MenuItem1 = GUICtrlCreateMenu("&Start Clicking")
$MenuItem3 = GUICtrlCreateMenu("S&top Clicking")
$MenuItem2 = GUICtrlCreateMenu("&Exit")

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
    If $nMsg = $Button1 Then
       ;from here u make the action loops until another event is present
        Do 
            MouseClick ("right")
       ; and here is the stop event
        Until _IsPressed (75,$dll)  ;75 is the No for F6
    EndIf
WEnd

DllClose($dll)

this will keep on clicking the right moue btn until u press F6

if u explain more would be much better

Edited by star2

[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Share this post


Link to post
Share on other sites

Clicking part is done, now, how do I make the progress bar like..

|

_|

__|

___|

____|

insead of

|

||

|||

||||

|||||?

Share this post


Link to post
Share on other sites

Clicking part is done, now, how do I make the progress bar like..

|

_|

__|

___|

____|

insead of

|

||

|||

||||

|||||?

what progress bar?

r u ok with clicking part? I really didn't get u


[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Hmm, so:

#include <GUIConstants.au3>

#include <Misc.au3>   ; important
$dll = DllOpen("user32.dll")

$Form1_1 = GUICreate("AngelSL's PQ-In", 331, 131, 367, 568)
$Group1 = GUICtrlCreateGroup("Autoclicker", 8, 0, 313, 105)
$Input1 = GUICtrlCreateInput("", 112, 48, 193, 21)
$Label1 = GUICtrlCreateLabel("Autoclicker Speed", 16, 48, 91, 17)
$Progress1 = GUICtrlCreateProgress(17, 16, 295, 25)
GUICtrlSetData(-1, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$MenuItem1 = GUICtrlCreateMenu("Start Clicking > F11")
$MenuItem3 = GUICtrlCreateMenu("Stop Clicking > F12")
$MenuItem2 = GUICtrlCreateMenu("Exit")
GUISetState(@SW_SHOW)

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
 ;  If $nMsg = $Button1 Then
      ;from here u make the action loops until another event is present
 ;    Do
  ;      MouseClick("left")
      ; and here is the stop event
  ;  Until _IsPressed(75,$dll) ;75 is the No for F6
  ; EndIf
   If _IsPressed(80,$dll) Then
           Do
           MouseClick("left","","","", GUICtrlRead($Input1))
       Until _IsPressed(81,$dll)
       EndIf
          
WEnd

DllClose($dll)

Is 80 F11 and is 81 F12?

Edited by AngelSL

Share this post


Link to post
Share on other sites

As for the progress bar, the scrolling ones are useless. Many large programs use them because the programs would waste time calculating the estimated time. If you are performing a process that the user can see, the progress bar is unnecessary.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Okay. Apparantly this doesn't work..

#include <GUIConstants.au3>

#include <Misc.au3>    ; important
$dll = DllOpen("user32.dll")

$Form1_1 = GUICreate("AngelSL's PQ-In", 331, 81, 367, 568)
$Group1 = GUICtrlCreateGroup("Autoclicker", 8, 0, 313, 57)
$Input1 = GUICtrlCreateInput("", 112, 24, 193, 21)
$Label1 = GUICtrlCreateLabel("Autoclicker Speed", 16, 24, 91, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$MenuItem1 = GUICtrlCreateMenu("&Start Clicking > F11")
$MenuItem3 = GUICtrlCreateMenu("S&top Clicking > F12")
$MenuItem2 = GUICtrlCreateMenu("&Exit")
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
  ;  If $nMsg = $Button1 Then
       ;from here u make the action loops until another event is present
  ;      Do
   ;         MouseClick("left")
       ; and here is the stop event
   ;     Until _IsPressed(75,$dll)  ;75 is the No for F6
   ; EndIf
   If _IsPressed("7A",$dll) Then
           Do
           MouseClick("left","","","", GUICtrlRead($Input1))
       Until _IsPressed("7B",$dll)
       EndIf
          
WEnd

DllClose($dll)

Okay, I have chopped off the progress bar like you said.

Edited by AngelSL

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

; improved by Star2
;==================
#include <GUIConstants.au3>
#include <Misc.au3>

$dll = DllOpen("user32.dll")

$Form1_1 = GUICreate("AngelSL's PQ-In", 331, 81, 367, 568)
$Group1 = GUICtrlCreateGroup("Autoclicker", 8, 0, 313, 57)
$Input1 = GUICtrlCreateInput("", 112, 24, 193, 21)
$Label1 = GUICtrlCreateLabel("Autoclicker Speed", 16, 24, 91, 17)
$start = GUICtrlCreateMenu("&Start Clicking > F11")
$stop = GUICtrlCreateMenu("S&top Clicking > F12")
$close = GUICtrlCreateMenuItem("Exit", -1)
GUISetState(@SW_SHOW)

While 1
    $Msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
        ExitLoop
    EndIf
    If $Msg = $close Then
        Exit
    EndIf
    If _IsPressed ("7a",$dll) Then
        Do
        MouseClick ("left")
        Until _IsPressed ("7b",$dll)
    EndIf
WEnd

DllClose($dll)

search help file for MouseClick

to get more info

Edited by star2

[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Share this post


Link to post
Share on other sites

Well, I just want to set the speed, but it is at the back, so that means x and y need to be defined?!

Share this post


Link to post
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
Sign in to follow this  
Followers 0