Jump to content
Sign in to follow this  
Gunso

AutoIt seems input too fast?

Recommended Posts

Gunso

I am new to AutoIt and this is my first AutoIt script just want to try out the automate installation of program under Windows XP. I begin with foobar2000 v0.9.4.3. When execute the compiled script below foobar2000 got successfully installed but to the wrong Program Directory path and wrong StartMenu path. It seems that AutoIt clicking "Next" too fast during the script execution and only part of the program path being input to the setup program:

Intended Program Path: C:\Program Files\foobar

Result Path: C:\P

Intended StartMenu Path: C:\Documents and Settings\All Users\Start Menu\Programs\Foobar

Result Path: C:\Documents and Settings\All Users\Start Menu\Programs\rogram Files\FoobarFoobar

My AutoIt foobar Script as follow:

Run ("foobar094.exe")

; Welcome

WinWaitActive ( "foobar2000 v0.9.4.3 Setup" , "Welcome" )

ControlClick ( "foobar2000 v0.9.4.3 Setup" , "" , "Button2" )

; License

WinWaitActive ( "foobar2000 v0.9.4.3 Setup" , "License" )

ControlClick ( "foobar2000 v0.9.4.3 Setup" , "" , "Button2" )

; Choose Components

WinWaitActive ( "foobar2000 v0.9.4.3 Setup" , "Choose which features of foobar2000" )

Send ("{TAB}")

Send ("{DOWN}")

Send ("{RIGHT}")

Send ("{DOWN}")

Send ("{DOWN}")

Send ("{DOWN}")

Send ("{DOWN}")

Send ("{RIGHT}")

Send ("{DOWN}")

Send ("{DOWN}")

Send ("{DOWN}")

Send ("{DOWN}")

Send ("{SPACE}")

ControlClick ( "foobar2000 v0.9.4.3 Setup" , "" , "Button2" )

; Choose Install Location

WinWaitActive ( "foobar2000 v0.9.4.3 Setup" , "To install in a different folder" )

Send ( @ProgramFilesDir & "\Foobar" )

ControlClick ( "foobar2000 v0.9.4.3 Setup" , "" , "Button2" )

; Choose Start Menu Folder

WinWaitActive ( "foobar2000 v0.9.4.3 Setup" , "Select the Start Menu folder" )

Send ( "Foobar" )

ControlClick ( "foobar2000 v0.9.4.3 Setup" , "" , "Button2" )

;Installation completed

WinWaitActive ( "foobar2000 v0.9.4.3 Setup" , "foobar2000 has been installed on your computer")

Send ("{SPACE}")

ControlClick ( "foobar2000 v0.9.4.3 Setup" , "" , "Button2" )

; Delete StartMenu's Shortcuts

FileDelete(@ProgramsCommonDir & "\Foobar" & "\foobar2000 - Website.url")

FileDelete(@ProgramsCommonDir & "\Foobar" & "\Uninstall.lnk")

; Rename StartMenu's Shortcuts

FileMove(@ProgramsCommonDir & "\Foobar" & "\foobar2000.lnk", @ProgramsCommonDir & "\Foobar" & "\foobar 0.9.4.3.lnk", 1)

Solution

I have too add Sleep (1000) right after the following statements before I can get it install correctly to the right path:

; Choose Install Location

Send ( @ProgramFilesDir & "\Foobar" )

Sleep (1000)

; Choose Start Menu Folder

Send ( "\Foobar" )

Sleep (1000)

More interesting finding is that I tried another similar AutoIt AddOn package which downloaded from the net for installation of foobar2000 v0.8.3 and it just work out as expected, when I checked again the source of the script it is exactly the same as mine WITHOUT adding any Sleep (1000) function. No dely being inserted after the path input statements but the same script modify/apply to v0.9.4.3 failed again. Really scratching head.... your advices are much appreciated!

One more question, is there any easier means to debug the script execution without just simply adding Sleep (10000) everywhere in the code? Any step by step execution debugging features is available within the SciTE editor or any AutoIt degugging tools available?

Many thanks for your advices in advanced!

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  

×