Jump to content

Recommended Posts

Posted

right now i have this, what i want to do is when i call for the pause func to pause the script, but because its in a loop it dont think its working, is there anyway to achieve this?

While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = 0
            ContinueLoop
        Case $msg = $start
            Start()
        Case $msg = $stop
            Pause()
        Case $msg = $exit
            Exit
    EndSelect
WEnd

Exit

Func Pause()
    If $Pause = 1 Then
        $Pause = 0
    Elseif $Pause = 0
        $Pause = 1
    EndIf
EndFunc

Func Start()
    While $a < 1
        If $Pause = 1 Then
            Panel()
            BG()
        ;Join()
            Sleep(10000)
        Elseif $Pause = 0 Then
            $a = 2
        EndIf
    WEnd
EndFunc
  • Moderators
Posted

I see you have two other functions as well as what you posted. You'll need to make conditions for the Global $Pause variable in all your functions, checking it periodically to see if it is paused and take an appropriate action then.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted

Hi, first sorry about my poor english.

If you don't want to check if the program is paused in every loop or function, maybe you can use HotKeySet(), when you want to pause your script use Send() with the key that activate the HotKeySet(), like the HotKeySet is global and works in all script you don't have to worry about where is the script for paused it.

I hope it will help you, any doubt you have I'll try to help.

Posted

yea i thought about using hotkeys, but i made a tray menu for this script and hope to have a pause button in it.

Posted

how would i check for something when its running in a loop? i can't even exit with the exit button when its stuck in the loop. And i want it in a loop to do keep on going until i pause or exit the program.

Posted

ok, but my loop goes every 10 second, how would i make it check for pauses within that 10 second?

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...