Jump to content

Recommended Posts

Posted (edited)

I am baffled. I have a script that works fine on 1 PC but doesn't work on my other PC. According to my IS department, they PCs are identical in setup.

PC1:

AutoIt ver 3.3.8.1

IE 8

PC2:

AutoIt ver 3.3.8.1

IE 8

; ECM Master
If Not WinActive("[TITLE:ECM_Master; CLASS:IEFrame]","http://lynpim.mycompany.com/pim/form/ECM_Master.html") Then _
     WinActivate("[TITLE:ECM_Master; CLASS:IEFrame]","http://lynpim.mycompany.com/pim/form/ECM_Master.html")
    WinSetState ("[TITLE:ECM_Master; CLASS:IEFrame]","http://lynpim.mycompany.com/pim/form/ECM_Master.html", @SW_MAXIMIZE)

$oIEMaster= _IECreate("http://lynpim.mycompany.com/pim/form/ECM_Master.html", 1)
$oForm = _IEFormGetCollection ($oIEMaster, 0)
$oQuery = _IEFormElementGetObjByName ($oForm, "htmlform")
$elements = _IEFormElementGetCollection($oForm)

For $element in $elements

If StringInStr($element.value, "Release a New Mat'l/Doc") > 0 Then
    $New_Button = $element
EndIf

Next

_IEAction($New_Button, "click")

As I said, when I run this on PC1, it works just fine and does what it is suppose to do; click the "Release a New Mat'l/Doc" button. However, when I run this on PC2, I receive this error:

U:AutoIt filesAU3 filesPIM ECMsTest!NewPartAnnotate.au3 (81) : ==> Variable must be of type "Object".:

For $element in $elements

For $element in $elements^ ERROR

Does anyone have any ideas of things I can try? I really need to be able to run this on multiple machines.

Thanks,

Kristine

Edited by TripScott
Posted (edited)

did the IE object not get created, did the form not load, did the object not load, did the collection not load...who knows. Put in error handling so we can see exactly what's going on.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Posted

Thank you for your help. With error handling I was able to determine that it was one of the include files that was causing the error. Once I copied the file from the other PC it worked.

Thank you so much.

Kristine

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
×
×
  • Create New...