Sign in to follow this  
Followers 0
PopSmith

Creating Infinite Loop - Possible to end it by specific key press (Such as control+s)

6 posts in this topic

Hello,

I have got my script to do just about everything I want it too except one (or maybe more if its coded wrong) thing.

Here is my script:

While $msg <> $GUI_EVENT_CLOSE
    $msg = GUIGetMsg()
    
    Select
    ;;;;;;;;;;;;;;;;;;;;;;;
    ;;                ;;
    ;;     LinkY's    ;;
    ;;                ;;
    ;;;;;;;;;;;;;;;;;;;;;;;
        
    ;case for "AutoCM"
        
        Case $msg = $Click_For_Auto_CM
        Send("{LWIN}{UP 22}{ENTER}")
        Sleep(500)
        Send("{TAB 17}{DOWN 8}")
        
    EndSelect
WEnd

Here is what I want it to do:

While $msg <> $GUI_EVENT_CLOSE
    $msg = GUIGetMsg()
    
    Select
    ;;;;;;;;;;;;;;;;;;;;;;;
    ;;                ;;
    ;;     LinkY's    ;;
    ;;                ;;
    ;;;;;;;;;;;;;;;;;;;;;;;
        
    ;case for "AutoCM"
        
        Case $msg = $Click_For_Auto_CM
        Send("{LWIN}{UP 22}{ENTER}")
        Sleep(500)
        Send("{TAB 17}{DOWN 8}")
             StatusbarGetText ( "Outlook Express - My Emails" [, 1] )
                ;Start Loop HERE
                  If Status Bar Text 1 is 0 messages(s), 0 unread
                  Then Sleep (300000) Check Status Bar Text again.
                  Else Send({TAB}{ENTER}{TAB}{ENTER})
                  Sleep(1500000)
                ;End Loop
    EndSelect
WEnd

Share this post


Link to post
Share on other sites



Not exactly sure what you're doing, but I can answer the question in the title of the thread. What I would do is make a Hotkey, and inside that function set a variable to 1 that tells the loop to exitloop. Example:

HotKeySet ("^s", "NoMoreLooping")
Global $StopLoop = 0

While 1
   ; this is your loop
    Sleep (100)
    If $StopLoop = 1 Then
        $StopLoop = 0
        ExitLoop
    EndIf
WEnd

Func NoMoreLooping()
    $StopLoop = 1
EndFunc

Share this post


Link to post
Share on other sites

Not exactly sure what you're doing, but I can answer the question in the title of the thread. What I would do is make a Hotkey, and inside that function set a variable to 1 that tells the loop to exitloop. Example:

HotKeySet ("^s", "NoMoreLooping")
Global $StopLoop = 0

While 1
  ; this is your loop
    Sleep (100)
    If $StopLoop = 1 Then
        $StopLoop = 0
        ExitLoop
    EndIf
WEnd

Func NoMoreLooping()
    $StopLoop = 1
EndFunc
So sayeth the Lord. Yep you are right muh friend. You hit the nail on the head when it comes to the topic! I award you 10 Experts Exchange Points!

[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Share this post


Link to post
Share on other sites

OK, sorry I am not quite sure how to integrate the looping into my script.

Here is the basics of my script:

While $msg <> $GUI_EVENT_CLOSE
    $msg = GUIGetMsg()

    Select
    ;;;;;;;;;;;;;;;;;;;;;;;
    ;;                ;;
    ;;     LinkY's    ;;
    ;;                ;;
    ;;;;;;;;;;;;;;;;;;;;;;;

    ;case for "AutoCM"

        Case $msg = $Click_For_Auto_CM
        Send("{LWIN}{UP 22}{ENTER}")
        Sleep(500)
        Send("{TAB 17}{DOWN 8}")
        Sleep(1000)
        $x = StatusbarGetText("Classical-Mail - Outlook Express")
        MsgBox(0, "Classical-Mail status bar says:", $x)

Basically I want it to check what the box says (example, 2 message(s), 2 unread) and if it says anything other then 0 message(s), 0 unread then it will continue looping the script until I press Control+S (which, as greenmachine pointed out, is done with a HotKeySet Function).

Thank you for any help you can provide :o

Share this post


Link to post
Share on other sites

If $Var <> 0 Then ContinueLoop? (this restarts the loop from the beginning)


[center]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.[/center]

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

EDIT: NVM, I figured it all out. Turns out I was missing a piece and had another in the wrong place!! :o

Edited by PopSmith

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