Sign in to follow this  
Followers 0
Thurines

Check checkbox without form tag in html-code

3 posts in this topic

Hi!

Im new to the forums and to scripting/autoIT and Im trying to use it to automate an installation of CCleaner as a test. The problem is when the last step in the installation appears there is an embedded html-code with a checkbox with a question regarding if I want to install google toolbar with it. I want to uncheck this checkbox. I tried some different functions in the _IE library but I cant get it to work. The problem is that this html-code also is missing a form-tag and only include the tag for the checkbox.

Here is the code for my script:

#RequireAdmin
#include <IE.au3>

$s_mode = "Embedded"

Run("ccsetup302.exe")

WinWaitActive("Installer Language")
Send("{ENTER}")
WinWaitActive("CCleaner v3.02 Installation","Välkommen till installationsguiden för CCleaner v3.02.")
Send("!N")
WinWaitActive("CCleaner v3.02 Installation","Licensavtal")
Send("!G")
WinWaitActive("CCleaner v3.02 Installation","Installationsalternativ")
ControlCommand("CCleaner v3.02 Installation","Installationsalternativ", 1200, "UnCheck")
ControlCommand("CCleaner v3.02 Installation","Installationsalternativ", 1201, "Check")
ControlCommand("CCleaner v3.02 Installation","Installationsalternativ", 1202, "Check")
ControlCommand("CCleaner v3.02 Installation","Installationsalternativ", 1203, "UnCheck")
ControlCommand("CCleaner v3.02 Installation","Installationsalternativ", 1204, "UnCheck")
Send("!N")
WinWaitActive("CCleaner v3.02 Installation","Gratis!")

;about here is where the problem start
;**********************************************************

$ieCtrl = WinGetHandle("CCleaner v3.02 Installation","Gratis!")

$ieWin = _IEAttach($ieCtrl, $s_mode)

$oForm = _IEFormGetCollection($ieWin)
_IEFormElementCheckBoxSelect($oForm, "install1", "", 1)

;The code after this gets executed
;**********************************************************

Send("!I")

This is the error message I get in SciTE when hitting F5 to run this code in Windows XP SP3:

--> IE.au3 V2.4-0 Error from function _IEFormElementCheckboxSelect, $_IEStatus_InvalidObjectType

And here comes the html-code that is missing the <form> tag:

<html DIR="LTR">
<body style="background-color:white;font-family:Arial;font-size:12px;margin:0;padding:0">

<div style="width:450px;height:228px;overflow:hidden;border:1px solid #666;padding:4px 16px;margin:0;">

<img src="toolbar-screenshot.jpg" vspace="5" />  
<br />
<span style="padding-left:7px;">
<b>Med Google Verktygsfält blir det enklare att bläddra på Internet:</b>
</span>
<br />
<ul style="margin:8px 0 0 50px;">
  <li>Sök från vilken webbplats som helst</li>
  <li>Översätt webbsidor direkt</li>
  <li>Fyll i webbformulär automatiskt med ett enda klick</li>
</ul>

<div style="padding-top:15px;">
&nbsp;<INPUT type="checkbox" CHECKED id="install1" name="install1">
<label for="install1"><b>Installera Google Verktygsfält gratis med CCleaner</b></label>
<br />
<div style="font-size:11px;padding-left:7px">
Genom att installera detta program godkänner du <a target="_blank" href="http://www.google.com/accounts/tos?hl=sv">användarvillkoren</a> och <a target="_blank" href="ttp://www.google.com/support/toolbar/bin/static.py?page=privacy.html&hl=sv&v=">sekretesspolicyn</a> för Google Verktygsfält.
Du kan när som helst ta bort det igen
</div>
</div>

</div>

</body>

</html>

My guess is that there is something wrong with this line in the autoit script:

$oForm = _IEFormGetCollection($ieWin)

Sence that is the object Im trying to use in

_IEFormElementCheckBoxSelect($oForm, "install1", "", 1)

Any help is appreciated and thanks in advance!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Use InetGet to link to the download. That would eliminate most of your code. Keeps it simple.

CCleaner supports command line in installation. Look here:

http://www.piriform.com/docs/ccleaner/advanced-usage/command-line-parameters.

To do what you have in mind, do this:

InetGet("http://www.piriform.com/ccleaner/download/slim/ccsetup302_slim.exe", @TempDir & "\ccsetup302_slim.exe")

run(TempDir & "\ccsetup302.exe /S")

Note: Not tested. I do see you uncheck items during your install, but you can download the slim installation that doesn't have the annoying toolbar they try to bundle in the installer.

Also, look here:

http://www.piriform.com/ccleaner/builds

Edited by MPH

Share this post


Link to post
Share on other sites

Thanks, I will try that.

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