Jump to content

Pausing Current action


Recommended Posts

im going to show the script that i have written but it will probably not make much sense as it is too hard to explain exactly what is happening and im sure no one would be familiar with the situation but the problem is....

HotKeySet("{HOME}","startwatch")
HotKeySet("{END}","stop")

MsgBox(0,"Instructions","Commands" & @CRLF & "Home Key = Start Script" & @CRLF & "End Key = Stop Script")

While 1
    Sleep(100)
WEnd

Func startwatch()
    
    $bloop = 1
    While $bloop = 1
        $sleep = InputBox("Refresh Rate","In seconds, about how fast does your computer update the galaxy view screen. (Estimate and round UP!!)")
            If @error = 1 Then
                Exit 0
            ElseIf $sleep = 0 Then
                    MsgBox(0,"Invalid","Please enter an number above 0")
            Else
                If $sleep > 3 Then
                    MsgBox(0,"WOW!","Your internet/computer fucking sucks. I do not think that debris watching is made out for you. Dumbass.")
                Else
                    $bloop = 0
                EndIf
            EndIf
    WEnd
            
    $setup = MsgBox(0,"Setup","Complete the following checklist in order to start watching the debris." & @CRLF & "1. Make sure you are using firefox." & @CRLF & "2. Enable the Highlight Big Debris function in foxgame, set the color to #FF0000 and the minimal debris size to 0." & @CRLF & "3. Make sure you are in the desired debris fields' system." & @CRLF & "4. Make sure that the find text when typing feature in firefox options is ENABLED.")
        If $setup = 2 Then
            Exit 0
        EndIf
    
    $dontfup = MsgBox(0,"DONT FUCK UP","After hitting ok, place the point of the mouse in the RED section of the debris field, you will have 10 seconds to do so. For more caution, click the spot that you want to be watched.")
        If $dontfup = 2 Then
            Exit 0
        EndIf
        
    Sleep(10000)
    
    $pos = MouseGetPos()
    
    $starting = MsgBox(0,"Starting","Debris Field Watch has started, Good Luck.")
        If $starting = 2 Then
            Exit 0
        EndIf
        
    $point = PixelGetColor($pos[0],$pos[1])
    
    MouseClick("left",$pos[0],$pos[1])
    
        $aloop = 1
            While $aloop = 1
                If $point = 16711680 Then
                    Send("System")
                    Send("{TAB DOWN}")
                    Send("{TAB UP}")
                    Sleep(100)
                    Send("{TAB DOWN}")
                    Send("{TAB UP}")
                    Sleep(100)
                    Send("{TAB DOWN}")
                    Send("{TAB UP}")
                    Sleep(100)
                    Send("{ENTER DOWN}")
                    Send("{ENTER UP}")
                    Sleep($sleep * 1000)
                    $point = PixelGetColor($pos[0],$pos[1])
                Else
                    $aloop = 0
                    Send("{PRINTSCREEN DOWN}")
                    Send("{PRINTSCREEN UP}")
                    MsgBox(0,"Done!","Screenshot taken! Open paint and paste into a new document to see the screenshot and then ... go own some bitches!!!")
                EndIf
EndFunc

Func stop()
    Exit 0
EndFunc

what i want is when the "startwatch" function has been started and it has reached the $aloop that i can pause the function at any given time. and then when i want it to start again...i want it to stop at the same time.

so for instance, im in the middle of a 4 second sleep and i want to pause the script. i hit a button, the script pauses. i then hit that same button (preferably) and then i either start again at that moment when i paused or just back up at the top of the #aloop

simply, i want to avoid going back to the questions and information gathering

does anyone know how this can be done?!?!

thanks :)

Link to comment
Share on other sites

  • Moderators

dorkbrains, (not a flattering nick, I must say! ;-))

First, welcome to the AutoIt forums.

A good start - some code to work on and a clear question. I wish some other newcomers would do the same. Using the Search facility is a good tip as there is a pretty good chance your question, or something like it, has been asked before. Look for the "Search" button to the right in the title bar. I found this pretty quickly:

Global $Paused = False
HotKeySet("{pause}", "TogglePause") 
HotKeySet("{ESC}", "Terminate") 

While 1 
    For $x = 1 to 999
        Sleep(1)
        ToolTip($x & " - Running",200,200)
    Next
WEnd 

Func TogglePause() 
    $Paused = NOT $Paused 
    While $Paused
        ToolTip($x & " - Paused",200,200)
    Wend
EndFunc 

Func Terminate() 
Exit 0 
EndFunc

From the Help file: "A hotkey-press *typically* interrupts the active AutoIt function/statement and runs its user function until it completes or is interrupted". So this code can interrupt almost anything (see the Help page for HotKeySet for full details). You should be able to adjust it to your script without too many problems - but if you do run into trouble, you know where we are. :-)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

dorkbrains, (not a flattering nick, I must say! ;-))

First, welcome to the AutoIt forums.

A good start - some code to work on and a clear question. I wish some other newcomers would do the same. Using the Search facility is a good tip as there is a pretty good chance your question, or something like it, has been asked before. Look for the "Search" button to the right in the title bar. I found this pretty quickly:

Global $Paused = False
HotKeySet("{pause}", "TogglePause") 
HotKeySet("{ESC}", "Terminate") 

While 1 
    For $x = 1 to 999
        Sleep(1)
        ToolTip($x & " - Running",200,200)
    Next
WEnd 

Func TogglePause() 
    $Paused = NOT $Paused 
    While $Paused
        ToolTip($x & " - Paused",200,200)
    Wend
EndFunc 

Func Terminate() 
Exit 0 
EndFunc

From the Help file: "A hotkey-press *typically* interrupts the active AutoIt function/statement and runs its user function until it completes or is interrupted". So this code can interrupt almost anything (see the Help page for HotKeySet for full details). You should be able to adjust it to your script without too many problems - but if you do run into trouble, you know where we are. :-)

M23

awesome man!! this worked perfectly. thanks a bunch.

and ill be sure to search next time :)

thanks again!!

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