Jump to content

Please help with my first script


 Share

Recommended Posts

I am writing my first script and I am having trouble automating the installation of firefox fox. Basically it gets stuck at the license agreement page. I think it has something to do with that the license agreement appears in a sub window but I can't seem to work around that. Could someone help please?

Run ("Firefox Setup 2.0.0.6.exe")

WinWaitActive ("Mozilla Firefox Setup", "close all other applications before starting Setup")
Send("!n")

WinWaitActive ("Mozilla Firefox Setup", "I &accept the terms in the License Agreement")
WinActivate("Mozilla Firefox Setup")
ControlClick ("Mozilla Firefox Setup", "I &accept the terms in the License Agreement", 1034)
Send("!n")

WinWaitActive ("Mozilla Firefox Setup", "Choose setup options")
Send("!n")

WinWaitActive ("Mozilla Firefox Setup", "Mozilla Firefox has been installed on your computer.")
ControlClick ("Mozilla Firefox Setup", "Mozilla Firefox has been installed on your computer.", 1203)
Send("!f")

BTW I'm woking with the newest version of firefox so if you want to test it you could just download the .exe file from firefox.com.

Link to comment
Share on other sites

Welcome,

Looks like it may halt at the 1st WinWaitAcitve(). I have not had a script work with a text parameter not starting from the very left of a line of text onwards yet. Would advise to start from the left and trim at any point is suitable.

Here are some changes that may work better.

Run ("Firefox Setup 2.0.0.6.exe")

WinWait ("Mozilla Firefox Setup", "Welcome to the Mozilla Firefox")
ControlClick("Mozilla Firefox Setup", "Welcome to the Mozilla Firefox", '&Next >')

WinWait ("Mozilla Firefox Setup", "License Agreement")
ControlClick ("Mozilla Firefox Setup", "License Agreement", 'Button4')
ControlClick("Mozilla Firefox Setup", "License Agreement", '&Next >')

WinWait ("Mozilla Firefox Setup", "Choose setup options")
ControlClick("Mozilla Firefox Setup", "Choose setup options", '&Next >')

WinWait ("Mozilla Firefox Setup", "Completing the Mozilla Firefox")
ControlClick ("Mozilla Firefox Setup", "Completing the Mozilla Firefox", 'Button4')
ControlClick("Mozilla Firefox Setup", "Completing the Mozilla Firefox", '&Finish')oÝ÷ ØGb´*'¶º%~éܶ*'±ªÞÞuê^ÖæòuçÚº[ZܨºÇÚ$zwpzY^ ©òÁ¬®«ªlºÇ²,Â+«­¢+ÙIÕ¹]¥Ð ÌäìÅÕ½Ðí¥É½àMÑÕÀȸÀ¸À¸Ø¹áÅÕ½ÐìµµÌÌäì¤
Edited by MHz
Link to comment
Share on other sites

Welcome,

Looks like it may halt at the 1st WinWaitAcitve(). I have not had a script work with a text parameter not starting from the very left of a line of text onwards yet. Would advise to start from the left and trim at any point is suitable.

Here are some changes that may work better.

Run ("Firefox Setup 2.0.0.6.exe")

WinWait ("Mozilla Firefox Setup", "Welcome to the Mozilla Firefox")
ControlClick("Mozilla Firefox Setup", "Welcome to the Mozilla Firefox", '&Next >')

WinWait ("Mozilla Firefox Setup", "License Agreement")
ControlClick ("Mozilla Firefox Setup", "License Agreement", 'Button4')
ControlClick("Mozilla Firefox Setup", "License Agreement", '&Next >')

WinWait ("Mozilla Firefox Setup", "Choose setup options")
ControlClick("Mozilla Firefox Setup", "Choose setup options", '&Next >')

WinWait ("Mozilla Firefox Setup", "Completing the Mozilla Firefox")
ControlClick ("Mozilla Firefox Setup", "Completing the Mozilla Firefox", 'Button4')
ControlClick("Mozilla Firefox Setup", "Completing the Mozilla Firefox", '&Finish')oÝ÷ ØGb´*'¶º%~éܶ*'±ªÞÞuê^ÖæòuçÚº[ZܨºÇÚ$zwpzY^ ©òÁ¬®«ªlºÇ²,Â+«­¢+ÙIÕ¹]¥Ð ÌäìÅÕ½Ðí¥É½àMÑÕÀȸÀ¸À¸Ø¹áÅÕ½ÐìµµÌÌäì¤
IT WORKS. Thanks. I was using the run instead of the controlclick because it is what the tutorial in the autoit help file said. just curious, what is the difference between winwait() and winwaitactive()? Again thanks for your help and quick response.
Link to comment
Share on other sites

IT WORKS. Thanks. I was using the run instead of the controlclick because it is what the tutorial in the autoit help file said. just curious, what is the difference between winwait() and winwaitactive()? Again thanks for your help and quick response.

Functions such as Send() and Mouse* functions require a active window so you use WinWaitActive() to ensure the window is ready to receive the input else the input will go to whatever is active which you do not want (note: You may need to activate the window in some cases before using WinWaitActive() else your script may stall).

The Control* functions do not require active windows so just waiting for the window to exist is enough, so WinWait() waits for the window to appear without any requirement for the window to become active. Installations done by this method are quick and more dependable then using Send() and/or Mouse* functions.

:)

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...