Jump to content
ascension

Script stopped working after IE 11 upgrade

Recommended Posts

ascension

Hello all,

We use this script to automate some information collecting on our workstations. After upgrading from IE 9 to IE 11 on our machines, the following section of the script hangs up.

 

I am very inexperienced at programming, but I was tasked with resolving this issue unfortunately. Any assistance would be greatly appreciated!

edit: forgot to include the fact that it throws the Find Edit Elements ERR into the console as it hangs up.

Func encryption02()
    $hwindow = ""
    $pcondition1 = ""
    $pcondition2 = ""
    $plink = ""
    $olink = ""
    $pcondition = ""
    $ouielementarray = ""
    $puielementarray = ""
    $ielements = ""
    Local $hwindow = WinGetHandle("User Client")
    If Not $hwindow Then Return ConsoleWrite("Window handle ERR" & @CRLF)
    ConsoleWrite("Window handle OK" & @CRLF)
    Local $ouiautomation = ObjCreateInterface($sclsid_cuiautomation, $siid_iuiautomation, $dtagiuiautomation)
    If Not IsObj($ouiautomation) Then Return ConsoleWrite("UI Automation object ERR" & @CRLF)
    ConsoleWrite("UI Automation object OK" & @CRLF)
    Local $pwindow, $owindow
    $ouiautomation.elementfromhandle($hwindow, $pwindow)
    $owindow = ObjCreateInterface($pwindow, $siid_iuiautomationelement, $dtagiuiautomationelement)
    If Not IsObj($owindow) Then Return ConsoleWrite("Automation element from window ERR" & @CRLF)
    ConsoleWrite("Automation element from window OK" & @CRLF)
    Local $pcondition
    $ouiautomation.createpropertycondition($uia_controltypepropertyid, $uia_editcontroltypeid, $pcondition)
    If Not $pcondition Then Return ConsoleWrite("Property condition ERR" & @CRLF)
    ConsoleWrite("Property condition OK" & @CRLF)
    Local $puielementarray, $ouielementarray, $ielements
    $owindow.findall($treescope_descendants, $pcondition, $puielementarray)
    $ouielementarray = ObjCreateInterface($puielementarray, $siid_iuiautomationelementarray, $dtagiuiautomationelementarray)
    $ouielementarray.length($ielements)
    If Not $ielements Then Return ConsoleWrite("Find edit elements ERR" & @CRLF)
    ConsoleWrite("Find all edit elements OK. Elements: " & $ielements & @CRLF)
    Local $pedit, $oedit, $sname, $oproperedit
    For $i = 0 To $ielements - 1
        $ouielementarray.getelement($i, $pedit)
        $oedit = ObjCreateInterface($pedit, $siid_iuiautomationelement, $dtagiuiautomationelement)
        $oedit.getcurrentpropertyvalue($uia_namepropertyid, $sname)
        ConsoleWrite("Name of edit element " & $i & ": " & $sname & @CRLF)
        If StringInStr($sname, "Encrypting (") Then
            If StringInStr($sname, "Encrypting (80") Then
                ExitLoop
            EndIf
            MsgBox(0, $sesltitle01, "EXITING: Computer is still encrypting: " & $sname)
            Exit
        EndIf
    Next

 

Edited by ascension

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

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.