Jump to content

_IEFormElementCheckboxSelect


Recommended Posts

Hope I'm in the right place for this question...

Using AutoItv3

I'm trying to automate MS ClearType Tuner and need to check a checkbox on the form

at http://www.microsoft.com/typography/cleart...tuner/tune.aspx.

It seemed that would be the easy part, yet I keep getting the same error in spite of taking the code

exactly from the help file.

Pleeze hep da noobe

thanx in advance

u

; This is working ------------------------------\/

#include <IE.au3>

; I already have the activeX ClearType Tuner installed and the IE window is open

WinActivate ( "Windows ClearType Tuner" )

$oIE = _IEAttach ("Windows ClearType Tuner")

$oForm = _IEFormGetObjByName ($oIE, "Windows ClearType Tuner", -1 )

; This is working ------------------------------/\

; This throws errror --> IE.au3 Error from function _IEFormElementCheckboxSelect, $_IEStatus_InvalidDataType

_IEFormElementCheckboxSelect ($oForm, "ActivateBox", "", 1)

I have tried every change to the parms to this function that I can find in the help and examples.

I just keep getting Invalid Data Type.

; From the help file

; _IEFormElementCheckBoxSelect

;( ByRef $o_object, $s_string [, $s_name = "" [, $f_select = 1 [, $s_mode = "byValue" [, $f_fireEvent = 1]]]] )

; From view source at http://www.microsoft.com/typography/cleart...tuner/tune.aspx

#cs

<TR>

<TD WIDTH="20"></TD>

<TD WIDTH="464" COLSPAN="5" VALIGN="top">

<P>

<I>Use the check box below to turn ClearType on or off. ClearType is on by default in Windows Vista. Once you

have turned ClearType on, please click &quot;Next&quot; to tune your ClearType

settings.</I>

</TD>

<TD WIDTH="265" COLSPAN="2"></TD>

</TR>

<TR>

<TD COLSPAN="8" WIDTH="765" HEIGHT="40"></TD>

</TR>

<TR>

<TD WIDTH="20"></TD>

<TD WIDTH="235" ALIGN="center" VALIGN="top"><P>

<INPUT id="ActivateBox" type="checkbox" name="ActivateBox" onpropertychange="return checkbox_updated1()">&nbsp;<I>Turn

on ClearType</I>

</TD>

#ce

Link to comment
Share on other sites

How do you know $oForm is valid? Might try an IsObj() on it to be sure... :)

When I run it with some testing for IsObj(), $oForm is not an object.

So I tried _IEFormGetCollection() instead, and I do get an object for the collection, but @extended = 0, which tells me there are no forms...?

#include <IE.au3>

; I already have the activeX ClearType Tuner installed and the IE window is open
WinActivate("Windows ClearType Tuner")

$oIE = _IEAttach("Windows ClearType Tuner")
If IsObj($oIE) Then
    $oForm = _IEFormGetCollection($oIE, -1)
    If IsObj($oForm) Then
        MsgBox(64, "Debug", "Form collection @extended = " & @extended)
        If _IEFormElementCheckBoxSelect($oForm, "ActivateBox", "", 1) Then
            MsgBox(64, "Success", "Seems to have worked.")
        Else
            MsgBox(16, "Error", "Function returned error:" & @CRLF & _
                    "@error = " & @error & @CRLF & _
                    "@extended = " & @extended)
        EndIf
    Else
        MsgBox(16, "Error", "$oForm was not an object:" & @CRLF & _
                "@error = " & @error & @CRLF & _
                "@extended = " & @extended)
    EndIf
Else
    MsgBox(16, "Error", "$oIE was not an object.")
EndIf

:)

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

  • Moderators

This should get you started...

#include <IE.au3>

$sURL = "http://www.microsoft.com/typography/cleartype/tuner/tune.aspx"

_IEErrorHandlerRegister()
$oIE = _IECreate($sURL)
$oCheckbox = _IEGetObjById($oIE, "ActivateBox")
$oButton = _IEGetObjById($oIE, "Next")
If Not $oCheckbox.checked Then
    $oCheckbox.checked = True
    $oCheckbox.fireEvent ("onchange")
    $oCheckbox.fireEvent ("onclick")
EndIf
_IEAction($oButton, "click")
_IELoadWait($oIE)
Link to comment
Share on other sites

#cs ----------------------------------------------------------------------------

AutoIt Version: 3.2.4.9

Author: uptimeinf

Script Function:

Simple little script to Automate the setup of MS ClearType.

Put your own selections in for "ChoiceXX" that look best

to you.

Requires:

ActiveX ClearType Control installed from:

http://www.microsoft.com/typography/cleart...tuner/tune.aspx

I just install it, close that window, then run this script

Fair Warning: This is just quick and dirty, throw-together, boilerplate stuff

Thank you to PsaltyDS for pointing out that my 1st approach could never work!

Thank you to Big_Daddy for the code that did in fact "get me started", and finished!

#ce ----------------------------------------------------------------------------

#include <IE.au3>

$sURL = "http://www.microsoft.com/typography/cleartype/tuner/tune.aspx"

_IEErrorHandlerRegister()

$oIE = _IECreate($sURL)

$oCheckbox = _IEGetObjById($oIE, "ActivateBox")

$oButton = _IEGetObjById($oIE, "Next")

If Not $oCheckbox.checked Then

$oCheckbox.checked = True

$oCheckbox.fireEvent ("onchange")

$oCheckbox.fireEvent ("onclick")

EndIf

_IEAction($oButton, "click")

_IELoadWait($oIE)

$oImage = _IEGetObjById($oIE, "choice21")

$oButton = _IEGetObjByName($oIE, "Next" ,1)

If Not $oImage.checked Then

$oImage.checked = True

$oImage.fireEvent ("onchange")

$oImage.fireEvent ("onclick")

EndIf

_IEAction($oButton, "click")

_IELoadWait($oIE)

$oImage = _IEGetObjById($oIE, "choice31")

$oButton = _IEGetObjByName($oIE, "Next", 2)

If Not $oImage.checked Then

$oImage.checked = True

$oImage.fireEvent ("onchange")

$oImage.fireEvent ("onclick")

EndIf

_IEAction($oButton, "click")

_IELoadWait($oIE)

WinClose ( "Windows ClearType Tuner - Microsoft Internet Explorer" )

Link to comment
Share on other sites

  • Moderators

Glad I was able to help. Here are my suggested changes.

#include <IE.au3>

$sURL = "http://www.microsoft.com/typography/cleartype/tuner/tune.aspx"

_IEErrorHandlerRegister()
$oIE = _IECreate($sURL)

$oCheckbox = _IEGetObjById($oIE, "ActivateBox")
$oButton = _IEGetObjByName($oIE, "Next", 0)

If Not $oCheckbox.checked Then
    $oCheckbox.checked = True
    $oCheckbox.fireEvent ("onchange")
    $oCheckbox.fireEvent ("onclick")
EndIf
_IEAction($oButton, "click")
_IELoadWait($oIE)

$oImage = _IEGetObjById($oIE, "choice21")
$oButton = _IEGetObjByName($oIE, "Next", 1)

_IEAction($oImage, "click")
_IELoadWait($oIE)
_IEAction($oButton, "click")
_IELoadWait($oIE)

$oImage = _IEGetObjById($oIE, "choice31")
$oButton = _IEGetObjByName($oIE, "Next", 2)

_IEAction($oImage, "click")
_IELoadWait($oIE)
_IEAction($oButton, "click")
_IELoadWait($oIE)

_IEQuit($oIE)
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...