Sign in to follow this  
Followers 0
Felide

Starting a simple script

3 posts in this topic

Greetings

I know it will be a noob question, but i am totaly new to coding and i seem to be unable to get to the core of my problem.

I made a simple script to make a predefined number of mouseclicks with start/stop hotkeys.

So far so easy, but the script always quits itself if i dont give the start-order in time.

To get this time, i inserted a sleep (10000) order at the beginning of my script, but this seems like a lousy solution to me.

May somebody of you can tell me, how i can get a script runing and waiting until i execute hotkeys.

with best wishes,

Felide

#cs ----------------------------------------------------------------------------
     
      AutoIt Version: 3.3.0.0
      Author:        myName
     
      Script Function:
         Template AutoIt script.
     
     #ce ----------------------------------------------------------------------------
     
    ; Script Start - Add your code below here
     
     
     
     HotKeySet (".", "MyExit")
     HotKeySet (",", "MyStart")
     
     MsgBox (0, "Autoklicker", "starten ,  stoppen .")
     
     
     sleep (10000)
     
     
     
     Func MyStart ()
     
     $i = $i +1
         Do
         MouseClick ("left")
         Sleep (1000)
         until $i = 6
         if $i= 5 then $i=0
         EndFunc
         
     Func MyExit ()
         Exit
     EndFunc

Share this post


Link to post
Share on other sites



#cs ----------------------------------------------------------------------------
     
AutoIt Version: 3.3.0.0
Author:         myName

Script Function:
 Template AutoIt script.

#ce ----------------------------------------------------------------------------
     
; Script Start - Add your code below here



HotKeySet (".", "MyExit")
HotKeySet (",", "MyStart")

MsgBox (0, "Autoklicker", "starten ,  stoppen .")
$i = 0


While 1
    Sleep(10)
WEnd

Func MyStart ()
    Do
        MouseClick ("left")
        Sleep (1000)
        $i += 1
    until $i = 6
    $i = 0
EndFunc

Func MyExit ()
    Exit
EndFunc


[font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap

Share this post


Link to post
Share on other sites

here i wrote an auto clicker for a buddy of mine a few weeks ago.. it was ment to close the inf command prompts that my other friend had opened.. but he uses it on games :D anyway.. here

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_outfile=AUTOCLICKER.exe
#AutoIt3Wrapper_Res_Description=AUTOCLICKER
#AutoIt3Wrapper_Res_LegalCopyright=BOB
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.0.0
 Author:         Bob

 Script Function:
    AUTOCLICKER
    
#ce ----------------------------------------------------------------------------
#Include <GUIConstantsEx.Au3>
#Include <WindowsConstants.Au3>
#Include <EditConstants.Au3>
#Include <StaticConstants.Au3>
#Include <Misc.Au3> 
#Include <GUIEdit.Au3>
#Include <Date.Au3>
#Include <Array.au3>
#include <ScrollBarConstants.au3>
#include <ProgressConstants.au3>
#Include <String.au3>
#Include <Timers.au3>
#Include <File.au3>

Opt ('GUIoneventmode',1)
Opt ('MouseCoordMode',2)

HotKeySet ('{F1}','START')
HotKeySet ('{F2}','END')
HotKeySet ('{ESC}','_Exit')

$Clicker = GUICreate ('CLICKER',200,100,-1,-1,-1,138)
GUICtrlCreateLabel ('SPEED :',10,15,50,20)
$Speed_Input = GUICtrlCreateInput ('100',70,10,50,20)
GUICtrlCreateLabel ('F1 = START',10,45,100,20)
GUICtrlCreateLabel ('F2 = END',110,45,100,20)

GUISetOnEvent ($GUI_EVENT_CLOSE,'_Exit',$Clicker)
GUISetState (@SW_SHOW,$Clicker)

Dim $ON = 0

While 1
    
    $Speed = GUICtrlRead ($Speed_Input)
    
    If $ON = 1 Then
        
        Sleep ($Speed)
        MouseClick ('Left')
        
    EndIf
    

WEnd

Func START ()
    
    $ON = 1
    
EndFunc

Func END ()
    
    $ON = 0
    
EndFunc

Func _Exit ()
    
    Exit
    
EndFunc

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