Sign in to follow this  
Followers 0
ChronoStriker1

Error with compiled script

2 posts in this topic

Right now I get an error when my script is run after compile. I ran the script again uncompiled and noticed two errors

_IEFormGetObjByName, $_IEStatus_NoMatch

_IEFormElementGetObjByName, $_IEStatus_InvalidDataType

Ive narrowed it down to this part of my code:

If $replacement = $radio1 Then

$oForm = _IEFormGetObjByName($oIE, "FORMMAIN")

$oRadio = _IEFormElementGetObjByName($oForm, "botton1")

If Not $oRadio = "" Then

If Not $oRadio.checked Then

With $oRadio

.checked = True

.fireEvent ("onchange")

.fireEvent ("onclick")

EndWith

EndIf

$reqlicence = _IEGetObjByName($oIE, "Action")

$oButton = _IEGetObjByName($oIE, "Action")

_IEAction($oButton, "focus")

Send("{SPACE}")

_IELoadWait($oIE)

EndIf

EndIf

The full script installes a program then registers it through a webportal. I put a selection if it was a replacement install or new, so we dont have to buy more licences then we need. The problem I have is that if a machine has multiple licences my code works cause it goes to a page and selects the first radio box (one of the licences) and continues. If the machine has only one licence assosciated with it it skips the page with the radio boxes and sends out an error. I think i need an if statement to see if formmain is there Im just not sure the best way of going about it.

Share this post


Link to post
Share on other sites



This adds some error reporting in the form of MsgBox'es:

If $replacement = $radio1 Then
    $oForm = _IEFormGetObjByName($oIE, "FORMMAIN")
    If @error = 0 And IsObj($oForm) Then
        $oRadio = _IEFormElementGetObjByName($oForm, "botton1")
        If @error = 0 And IsObj($oRadio) Then
            If $oRadio.checked Then
                With $oRadio
                    .checked = True
                    .fireEvent ("onchange")
                    .fireEvent ("onclick")
                EndWith
            EndIf
            ; $reqlicence = _IEGetObjByName($oIE, "Action") <--- duplicate object???
            $oButton = _IEGetObjByName($oIE, "Action")
            If @error = 0 And IsObj($oButton) Then
                _IEAction($oButton, "focus")
                Send("{SPACE}")
                _IELoadWait($oIE)
            Else
                MsgBox(16, "Error", "Error getting object:  Action")
            EndIf
        Else
            MsgBox(16, "Error", "Error getting FormElement object:  button1")
        EndIf
    Else
        MsgBox(16, "Error", "Error getting Form object:  FORMMAIN")
    EndIf
EndIf

I commented out what looked like a duplicate object, and it looks like _IEAction($oButton, "click") would work better than Send(), but that may not be the problem.

You should make sure you have included _IEErrorHandlerRegister() somewhere near the top of your script, also.

Hope that helps track it down.

:whistle:


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

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