Sign in to follow this  
Followers 0
Ultratech

A Loop Problem

2 posts in this topic

#1 ·  Posted (edited)

Trying to do something simple, exit a function. Nothing is working. I want to exit the function and resume the While 1.

#include <GuiConstants.au3>
HotKeySet("z", "FStart")
HotKeySet("x", "FReturn")
Local $pause

While 1
    Sleep(100)
WEnd

Func FStart()
Do
    Send("Running")
    Sleep(3000)
Until $pause = Not $pause
EndFunc

Func FReturn()
    $pause = Not $pause
Send("Not Running")
EndFunc

I want it to keep typing "Running" until "x" is pressed. It types "Not Running", but "Running" is still being typed. What else can I try. :whistle:

Nevermind I finally figured it out after an hour (see topic icon)

Edited by Ultratech

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

try this:

$pause = 0

Func FStart()
    $pause = 1
EndFunc

Func FReturn()
    $pause = 0
    Send("Not Running")
EndFunc

HotKeySet("z", "FStart")
HotKeySet("x", "FReturn")

While 1
    Sleep(100)
    While $pause = 1
        Send("Running")
        Sleep(3000)
    WEnd
WEnd

edit: oops, didn't see you fixed it yourself. oh well.

Edited by Kourath

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