Jump to content

StatusBarGetText and Timer


 Share

Recommended Posts

I want the script to sleep, until SatusBar says "Gereed".

The problem is that is allways say "Gereed", until I click the link.

Also, I want to add a counter of some sort. The script I use is for a turn based site, every 8 seconds you get a turn, and I need 5 turns to preform an action, that's 40 seconds. When the scripts starts, the timer will activate. And will only preform the last click when the 40 seconds have expired.

Sleep ( 500 )

    WinActivate ( '(SFGC) Galactic Conquest - Windows Internet Explorer' )
    WinWaitActive ( '(SFGC) Galactic Conquest - Windows Internet Explorer' )

StatusbarGetText ("Gereed")
    MouseClick ( "left", 402, 392 )
Sleep(500)

StatusbarGetText ("Gereed")
    MouseClick ( "left", 898, 395 )
Sleep(500)

StatusbarGetText ("Gereed")
Sleep(1000)
    MouseClickDrag ( "left", 900, 321, 700, 321 )

I don't know a lot of AutoIt, so please explain every step you've taken.

Link to comment
Share on other sites

I keep getting an error that WEnd has no matching While statement :S

When I erase all WEnd the While doesn't have a matching WEnd statement :S

Sleep ( 500 )

    WinActivate ( '(SFGC) Galactic Conquest - Windows Internet Explorer' )
    WinWaitActive ( '(SFGC) Galactic Conquest - Windows Internet Explorer' )
Send ("{F5}")
Send ("{ENTER}")

While Sleep (10)
If StatusBarGetText("(SFGC) Galactic Conquest - Windows Internet Explorer")="Gereed" Then
    
    MouseClick ( "left", 402, 392 )
    MouseMove (300,300)
    Sleep(500)
    
WEnd
        
        While Sleep (10)
        If StatusBarGetText("(SFGC) Galactic Conquest - Windows Internet Explorer")="Gereed" Then
                    
            MouseClick ( "left", 898, 395 )
            MouseMove (300,300)
            Sleep(500)
            
        WEnd
        
                While Sleep (10)
                If StatusBarGetText("(SFGC) Galactic Conquest - Windows Internet Explorer")="Gereed" Then
                                        
                    Sleep(1000)
                    MouseClick ( "left", 772, 300, 3 )
                    Send ( " ^c " )
                    Sleep ( 500 )
                    WinActivate ( 'Planet Checker' )
                    WinWaitActive ( 'Planet Checker' )
                    Send ( " ^v " )
    
                    Sleep ( 500 )
                    Send("{BACKSPACE 2}")
                    Send("{LEFT 3}")
.                   Send("{BACKSPACE 5}")
                    Sleep(500)
                    Send("{ENTER}")
                        
                    WinActivate ( '(SFGC) Galactic Conquest - Windows Internet Explorer' )
                    WinWaitActive ( '(SFGC) Galactic Conquest - Windows Internet Explorer' )

                    MouseClick ( "left", 772, 280, 3 )
                    Sleep ( 500 )
                    Send ( " ^c " )
                    Sleep ( 50 )
                    WinActivate ( 'Planet Checker' )
                    WinWaitActive ( 'Planet Checker' )
                    Send ( " ^v " )
                    Sleep(500)
                    Send("{BACKSPACE 7}")
                    Send("{LEFT}")
                    Send("{BACKSPACE 21}")
                    Sleep(500)
                    Send("{ENTER}")
                    
                WEnd
Edited by ColdDeath
Link to comment
Share on other sites

Out of control isn't a good description to help find a solution. Where does it stop doing as expected? What does it do that you think it shouldn't do?

Edit: you musta read my mind and changed it

Thats because your If loop isn't closed

Edited by youknowwho4eva

Giggity

Link to comment
Share on other sites

Out of control isn't a good description to help find a solution. Where does it stop doing as expected? What does it do that you think it shouldn't do?

Edit: you musta read my mind and changed it

Thats because your If loop isn't closed

Okay, fixed it. The only problem is that it keeps repeating, when it has pressed enter, it goes into a loop, and repeats every step taken...

Sleep ( 500 )

    WinActivate ( '(SFGC) Galactic Conquest - Windows Internet Explorer' )
    WinWaitActive ( '(SFGC) Galactic Conquest - Windows Internet Explorer' )
Send ("{F5}")
Send ("{ENTER}")


While Sleep (10)
If StatusBarGetText("(SFGC) Galactic Conquest - Windows Internet Explorer")="Gereed" Then
    
    MouseClick ( "left", 402, 392 )
    MouseMove (300,300)
    Sleep(500)

        While Sleep (10)
        If StatusBarGetText("(SFGC) Galactic Conquest - Windows Internet Explorer")="Gereed" Then
                    
            MouseClick ( "left", 898, 395 )
            MouseMove (300,300)
            Sleep(500)
                    
                While Sleep (10)
                If StatusBarGetText("(SFGC) Galactic Conquest - Windows Internet Explorer")="Gereed" Then
                                        
                    Sleep(1000)
                    MouseClick ( "left", 800, 300, 3 )
                    Send ( " ^c " )
                    Sleep ( 500 )
                    WinActivate ( 'Planet Checker' )
                    WinWaitActive ( 'Planet Checker' )
                    Send ( " ^v " )
    
                    Sleep ( 500 )
                    Send("{BACKSPACE 2}")
                    Send("{LEFT 3}")
                    Send("{BACKSPACE 21}")
                    Sleep(500)
                    Send("{ENTER}")
                    Sleep(500)
                        
                    WinActivate ( '(SFGC) Galactic Conquest - Windows Internet Explorer' )
                    WinWaitActive ( '(SFGC) Galactic Conquest - Windows Internet Explorer' )

                    MouseClick ( "left", 800, 280, 3 )
                    Sleep ( 500 )
                    Send ( " ^c " )
                    Sleep ( 50 )
                    WinActivate ( 'Planet Checker' )
                    WinWaitActive ( 'Planet Checker' )
                    Send ( " ^v " )
                    Sleep(500)
                    Send("{BACKSPACE 7}")
                    Send("{LEFT}")
                    Send("{BACKSPACE 21}")
                    Sleep(500)
                    Send("{ENTER}")
                    ExitLoop
                EndIf
                WEnd
        EndIf
        WEnd
EndIf
WEnd
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...