Sign in to follow this  
Followers 0
ImNewToThis

Return

8 posts in this topic

I wonder how i should do to make the script return and 'start again'

$bLoop = 1
While $bLoop = 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                Exit
            Case $Start
                    $data = GUICtrlRead($input1)
                    $data2 = GUICtrlRead($input2)
                    $data3 = GUICtrlRead($input3)
                    $data4 = GUICtrlRead($input4)
                    
                    
                                                  


                                 < ------------------------------------------------------------->To here and make the loop again
                sleep(4000)
                send("{enter}")
                    GUICtrlSetData($input1, $data)
                send($data)
                sleep(250)
                send("{enter}")
                Sleep(3000)
                GUICtrlSetData($input2, $data2)
                send($data2)
                sleep(250)
                send("{enter}")
                Sleep(3000)
                GUICtrlSetData($input3, $data3)
                send($data3)
                sleep(250)
                send("{enter}")
                Sleep(3000)
                GUICtrlSetData($input4, $data4)
                send($data4)
                sleep(250)
                send("{enter}");
                                <---------------------------------------------------------------> Return from here
                
            Case $Exit
                Exit
            Case Else
        EndSwitch
    WEnd
endfunc

Share this post


Link to post
Share on other sites



I am not sure if I understand your problem.

Could you not put that section of code in a separate function and call it?

Share this post


Link to post
Share on other sites

I am not sure if I understand your problem.

Could you not put that section of code in a separate function and call it?

i want it to start over and over and over again, now it stops after 4th, after that i want it to start from the 1st again, if you understand

Share this post


Link to post
Share on other sites

I would put the code in an external Function and call it with AdlibEnable :P ( remove the first Sleep and set Adlib Time to 4000.

To disable the Func, call AdlibDisable.


*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

I would put the code in an external Function and call it with AdlibEnable :P ( remove the first Sleep and set Adlib Time to 4000.

To disable the Func, call AdlibDisable.

thanks for answer :o But i don't know how to do that ''/ maybe you can write the code and where i have to put it ?

I'm sorry for being stupid. :P

Share this post


Link to post
Share on other sites

OK, an example:

#include <GUIConstants.au3>

#region - GUI Create
GUICreate('')
$button = GUICtrlCreateButton("go",10,10)
$button2 = GUICtrlCreateButton("stop",10,40)
GUISetState()
#endregion

#region - GUI SelectLoop
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $button2
            AdlibDisable()
        Case $msg = $button
            AdlibEnable("_AdlibFunc",4000)
    EndSelect
WEnd
#endregion

Func _AdlibFunc()
    SplashTextOn("splash","shows up all 4 seconds for 2 seconds :)" & @CLRF & "Menaing:" & _
    @CRLF : "SEC 0: This function called, show splash" & _
    @CRLF : "SEC 2: Splash will be hidden" & _
    @CRLF : "SEC 4: call func show splash" & _
    @CRLF : "SEC 6: ..." & _)
    Sleep(2000)
    SplashOff()
EndFunc

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

Thanks! realy helpfull :P

Share this post


Link to post
Share on other sites

hmm i didn't get that to work.is there another way? is there not a way like "restart 1" or anything like that ??? just restart the func?

:P

#include <GuiConstantsEx.au3>
    
$answer = MsgBox(4, "Start","Start ?")

; Check the user's answer to the prompt (see the help file for MsgBox return values)
; If "No" was clicked (7) then exit the script
If $answer = 7 Then
    Exit
EndIf

; Title
GuiCreate('ost', 250, 330)

; MENY
$spammer = GuiCtrlCreateMenu("ost")

; bild
GuiCtrlCreatePic("images\bäver2.jpg",0,155)
GuiCtrlSetColor(-1,0xffffff)

;Hotkey
GuiCtrlCreateGroup("Hotkeys", 165, 220, 73, 66)
GuiCtrlCreatelabel("F6 = Stop", 175,240)
GuiCtrlCreatelabel("F7 = Exit", 175,260)

Global $Paused
HotKeySet("{F6}", "TogglePause")
HotKeySet("{F7}", "Terminate")


Spam()
Delay()
SetHotkeys()
Terminate()
TogglePause()
ShowMessage()


Func Spam()
    local  $Exit
    local  $Start
    
    $Exit = GUICtrlCreateButton("Exit", 160,185, 83, 25)
    $Start = GUICtrlCreateButton("Start", 160,155, 83, 25)
    
;Text---------------------------->

$input1 = GUICtrlCreateInput("", 5,15, 155)
GUICtrlSetLimit(-1, 98)
$input2 = GUICtrlCreateInput("", 5,45)
GUICtrlSetLimit(-1, 98)
$input3 = GUICtrlCreateInput("", 5,75)
GUICtrlSetLimit(-1, 98)
$input4 = GUICtrlCreateInput("", 5,105)
GUICtrlSetLimit(-1, 98)

GUICtrlSetData($input1, "1 SpamText")
    GUICtrlSetData($input2, "2 SpamText")
    GUICtrlSetData($input3, "3 SpamText")
    GUICtrlSetData($input4, "4 SpamText")
    GUISetState()

;While---------------------------->

$bLoop = 1
While $bLoop = 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                Exit
            Case $Start
                    $data1 = GUICtrlRead($input1)
                    $data2 = GUICtrlRead($input2)
                    $data3 = GUICtrlRead($input3)
                    $data4 = GUICtrlRead($input4)
                    
                    
                ;------------------------------------------------------------> I want This area to keep going over and over again
                ;------------------------------------------------------------> I want This area to keep going over and over again
                ;------------------------------------------------------------> I want This area to keep going over and over again
                ;------------------------------------------------------------> I want This area to keep going over and over again
                ;------------------------------------------------------------> I want This area to keep going over and over again
                ;------------------------------------------------------------> I want This area to keep going over and over again
                ;------------------------------------------------------------> I want This area to keep going over and over again
                ;------------------------------------------------------------> I want This area to keep going over and over again
                ;------------------------------------------------------------> I want This area to keep going over and over again
                ;------------------------------------------------------------> I want This area to keep going over and over again
                ;------------------------------------------------------------> I want This area to keep going over and over again
                ;------------------------------------------------------------> I want This area to keep going over and over again


                
--------------------->  run("notepad.exe")
                sleep(3900)
                send("{enter}")
                GUICtrlSetData($input1, $data1)
                send($data1)
                sleep(100)
                send("{enter}")
                Sleep(2900)
                GUICtrlSetData($input2, $data2)
                send($data2)
                sleep(100)
                send("{enter}")
                Sleep(2900)
                GUICtrlSetData($input3, $data3)
                send($data3)
                sleep(100)
                send("{enter}")
                Sleep(2900)
                GUICtrlSetData($input4, $data4)
                send($data4)
                sleep(100)
                send("{enter}")
            
                
                
            Case $Exit
                Exit
            
            Case Else
        
        EndSwitch
    WEnd
endfunc
;-----------------------------------------------------------------------------------------------------------------------------

;PAUSE
Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('The Script is "Paused" to start again Press "F6" To Quit Press "F7"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc


;END
GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
WEnd

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