Jump to content
Sign in to follow this  
vandan2

Repeat Commands

Recommended Posts

vandan2

Hi guys i am new at scripting. i make a script. but i dont know how to repeat the commands after sleep. . here is the script :

While 1
    
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
             
        Case $Button1
            MouseClick ("left",718,465)
            MouseWheel("down", 4)
            MouseClick ( "left",726,800)
            
            Send("upupupupupupupu updullah upupupupuppuup")
            MouseWheel("down", 1)
        MouseClick ( "left",285,840)
        Sleep(3000)
        
        
            

     Case $Button2
         MsgBox (0, "Kodlayan" , "Bu program totolaraskina tarafından kodlanmıştır")
        Exit
        
        Case $Label1
    EndSwitch
WEnd

Its turkish :) How can i do that ? Please help me...

Edited by vandan2

Share this post


Link to post
Share on other sites
wakillon

Something like this ?

$_State = False

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $_State = Not $_State
        Case $Button2
            MsgBox (0, "Kodlayan" , "Bu program totolaraskina tarafindan kodlanmistir")
            Exit
        Case $Label1
            
    EndSwitch
    If $_State Then _Action ( )
WEnd

Func _Action ( )
    MouseClick ("left",718,465)
    MouseWheel("down", 4)
    MouseClick ( "left",726,800)
    Send("upupupupupupupu updullah upupupupuppuup")
    MouseWheel("down", 1)
    MouseClick ( "left",285,840)
    Sleep(3000)
EndFunc

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites
vandan2

yeah thats it wakilion. but now i cant close the script. i cant stop it :) how can i stop can you give the code again ?

Share this post


Link to post
Share on other sites
vandan2

now its and not working please fix

$_State = False

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $_State = Not $_State
        Case $Button2
            MsgBox (0, "Kodlayan" , "Bu program totolaraskina tarafindan kodlanmistir")
            Exit
        Case $Label1
            
    EndSwitch
    If $_State Then _Action ( )
WEnd

Func _Action ( )
    MouseClick ("left",718,465)
    MouseWheel("down", 4)
    MouseClick ( "left",726,800)
    Send("upupupupupupupu updullah upupupupuppuup")
    MouseWheel("down", 1)
    MouseClick ( "left",285,840)
    Sleep(3000)
EndFunc

        
        
            

     Case $Button2
         MsgBox (0, "Kodlayan" , "Bu program totolaraskina tarafından kodlanmıştır")
        Exit
        
        Case $Label1
    EndSwitch
WEnd
Edited by vandan2

Share this post


Link to post
Share on other sites
wakillon

press again Button1 for change state of $_State and you can stop it ! Posted Image


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites
vandan2

guys look at me again. i want to repeat all comands in script. here the clean script. its working but i want to do it all over again. all commands. thats the all codes :

wakillon your script is right its working without the button 2. please fix it and give me again

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("İnci Sözlük Entry Uplayıcı ", 341, 250, 453, 143)
$Button1 = GUICtrlCreateButton("Çalıştır !", 232, 8, 97, 113, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Dur Amk ! ", 224, 136, 113, 65, $WS_GROUP)
$Label1 = GUICtrlCreateLabel("Yazılacak Kelimeyi Alt Kısma Yaz Panpa", 0, 56, 230, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Input1 = GUICtrlCreateInput("up up up up updullah up up up up", 8, 80, 185, 21)
$Label2 = GUICtrlCreateLabel("Bu program totolaraskina tarafindan kodlanmıştır. Her hakkı saklıdı", 8, 216, 380, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)



While 1
    
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
             
        Case $Button1
            MouseClick ("left",718,465)
            MouseWheel("down", 4)
            MouseClick ( "left",726,800)
            
            Send("upupupupupupupu updullah upupupupuppuup")
            MouseWheel("down", 1)
        MouseClick ( "left",285,840)
        Sleep(3000)
        
        
            

     Case $Button2
         MsgBox (0, "Kodlayan" , "Bu program totolaraskina tarafından kodlanmıştır")
        Exit
        
        Case $Label1
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites
vandan2

its unstopable wakillon

Share this post


Link to post
Share on other sites
wakillon

Try this way

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Inci Sözlük Entry Uplayici ", 341, 250, 453, 143)
$Button1 = GUICtrlCreateButton("Çalistir !", 232, 8, 97, 113, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Dur Amk ! ", 224, 136, 113, 65, $WS_GROUP)
$Label1 = GUICtrlCreateLabel("Yazilacak Kelimeyi Alt Kisma Yaz Panpa", 0, 56, 230, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Input1 = GUICtrlCreateInput("up up up up updullah up up up up", 8, 80, 185, 21)
$Label2 = GUICtrlCreateLabel("Bu program totolaraskina tarafindan kodlanmistir. Her hakki saklidi", 8, 216, 380, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)

$_State = False

While 1
    
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
            
        Case $Button1
            $_State = Not $_State
            If $_State Then
                AdlibRegister ( '_Action', 3000 )
            Else
                AdlibUnRegister ( '_Action' )
            EndIf
    Case $Button2
        MsgBox (0, "Kodlayan" , "Bu program totolaraskina tarafindan kodlanmistir")
        Exit
        
        Case $Label1
    EndSwitch
WEnd

Func _Action ( )
    MouseClick ("left",718,465)
    MouseWheel("down", 4)
    MouseClick ( "left",726,800)
    Send("upupupupupupupu updullah upupupupuppuup")
    MouseWheel("down", 1)
    MouseClick ( "left",285,840)
EndFunc
Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites
vandan2

not working. when i pressed run ( çalıştır ) nothing happens.

Share this post


Link to post
Share on other sites
wakillon

Corrected

Retry


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites
vandan2

Thank you verry much ! I have 1 more question. How can add an hot key to the button 2 like F8 ?

Share this post


Link to post
Share on other sites
vandan2

Also sometimes button 2 doesnt work ?

Share this post


Link to post
Share on other sites
vandan2
Yeah button 2 is exit. its working before press the run ( calistir ) but after i press run button 2 doest working. i thing we need to change exit to stop or etc ?

Share this post


Link to post
Share on other sites
wakillon

Like this ?

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

HotKeySet ( "{ESC}", "_Exit" )

$Form1 = GUICreate("Inci Sözlük Entry Uplayici ", 341, 250, 453, 143)
$Button1 = GUICtrlCreateButton("Çalistir !", 232, 8, 97, 113, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Dur Amk ! ", 224, 136, 113, 65, $WS_GROUP)
$Label1 = GUICtrlCreateLabel("Yazilacak Kelimeyi Alt Kisma Yaz Panpa", 0, 56, 230, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Input1 = GUICtrlCreateInput("up up up up updullah up up up up", 8, 80, 185, 21)
$Label2 = GUICtrlCreateLabel("Bu program totolaraskina tarafindan kodlanmistir. Her hakki saklidi", 8, 216, 380, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)

$_State = False

While 1

    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            _Exit ( )
        Case $Button1
            $_State = Not $_State
            If $_State Then
                AdlibRegister ( '_Action', 3000 )
            Else
                AdlibUnRegister ( '_Action' )
            EndIf
        Case $Button2
            MsgBox ( 0, "Kodlayan" , "Bu program totolaraskina tarafindan kodlanmistir" )
            _Exit ( )
        Case $Label1

    EndSwitch
WEnd

Func _Action ( )
    MouseClick ("left",718,465)
    MouseWheel("down", 4)
    MouseClick ( "left",726,800)
    Send("upupupupupupupu updullah upupupupuppuup")
    MouseWheel("down", 1)
    MouseClick ( "left",285,840)
EndFunc

Func _Exit ( )
    GUIDelete ( $Form1 )
    AdlibUnRegister ( '_Action' )
    Exit
EndFunc
Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites
vandan2

Sorry for my all flods but its important.

There is only 1 problem left. I cant stop the program. When i pressed button 2 nothing happens.

Share this post


Link to post
Share on other sites
vandan2

ow yeah man ! you are awesome problem solved. thanks for everything. !

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  

×