Sign in to follow this  
Followers 0
ColdDeath

StatusBarGetText and Timer

9 posts in this topic

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.

Share this post


Link to post
Share on other sites



Please read the helpfile. There are timer functions as well as everything else you should need.

Ah! Got the timer :mellow:.

Only the StatusBarGetText is unclear for me.

Share this post


Link to post
Share on other sites

If StatusBarGetText("Internet Explorer")="gereed" Then
;; do stuff
EndIf

do you mean it like this?


[right]~What can I say, I'm a Simplistic person[/right]

Share this post


Link to post
Share on other sites

If StatusBarGetText("Internet Explorer")="gereed" Then
;; do stuff
EndIf

do you mean it like this?

Full title or in your case with AutoItSetOption("WinTitleMatchMode",2) .

When the words fail... music speaks

Share this post


Link to post
Share on other sites

That's not that big of a deal :mellow: it was just some short simple piece of coding I quickly qrote down.


[right]~What can I say, I'm a Simplistic person[/right]

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

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

Share this post


Link to post
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

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