Jump to content

Recommended Posts

Posted (edited)

my function

Func RemedyLogin() ; ########## Start of Function to log into Web Remedy ##########
    Local $oIE, $oForm, $oUserName, $oPass, $oServer, $sWindowTitle, $sMyString, $oLink, $oLinks, $sLinkText, $oIE2 ; Declaring local Variables for use in RemedyLogin function ONLY. Values will be 'null' on exit of this function

    $oIE = _IECreate ("site") ; Sets variable $oIE as the site address. Opens an instance of the remedy web login
    _IELoadWait ($oIE) ; Waits until the page is completely loaded before continuing script processing.

    $oForm = _IEFormGetObjByName ($oIE, "loginForm") ; Sets variable $oForm as value of the login page loginform
    $oUserName = _IEFormElementGetObjByName ($oForm, "username-id") ; Sets variable $oUserName as the value for web username text box
    $oPass = _IEFormElementGetObjByName ($oForm, "pwd-id") ; Sets variable $oPass as the value for web Password text box
    $oServer = _IEFormElementGetObjByName ($oForm, "auth-id") ; Sets variable $oServer as the value for web Server/authentication text box
    _IEFormElementSetValue ($oUserName, $uName) ; Populates the Username Box with the Global $uName variable from function GetLoginUname
    ;_IEFormElementSetValue ($oPass, $uPass) ; Populates the Password Box with the Global $uPass variable from function GetLoginPass. ***** Not being used at this time
    _IEFormElementSetValue ($oServer, $uServer) ; Populates the Server/authentication Box with the Global $uServer variable from function GetLoginServer
    _IEAction ($oPass, "focus") ; Sets the password to have focus
    ; _IEFormSubmit ($oForm) ; Will auto submit form. ***** Not being used at this time
    
    $oIE2 = ("error site")
    $sMyString = "Return to home page"
    

    ;Local $sWindowTitle ; Declaring local Variable for use in Error Page when logging into RemedyWEB. Values will be 'null' on exit of this function
    
    $sWindowTitle = "Remedy Mid Tier 6.3 - Error page - Windows Internet Explorer provided by company" ; Sets Value of Variable $sWindowTitle as the title of the Error Page
    
    WinWaitActive ($sWindowTitle) ; Script waits until the error message is active then proceeds
    
    ; MsgBox(0, "Accept", "Accept the Warning...") ; Asks the user to click the accept button on the warning banner. Only used as testing to ensure script/function could see the banner correctly
    ; _IELinkClickByText ($oIE2, "Return to home page")
    
    $oLinks = _IELinkGetCollection($oIE2)
    
    For $oLink in $oLinks
        $sLinkText = _IEPropertyGet($oLink, "innerText")
        If StringInStr($sLinkText, $sMyString) Then
            _IEAction($oLink, "click")
            ExitLoop
        EndIf
    Next
    
    WinWaitClose ($sWindowTitle) ; Function and script will continue to run until the warning banner has been closed.

EndFunc ; ########## End of Function to log into Web Remedy ##########

now for the error

--> IE.au3 V2.4-0 Error from function _IELinkGetCollection, $_IEStatus_InvalidDataType
C:\Program Files\AutoIt3\Include\Remedy_Test.au3 (132) : ==> Variable must be of type "Object".:
For $oLink in $oLinks
For $oLink in $oLinks^ ERROR

any idea as to why it wont click on that text/link? I took the example right out of the help file.

answered it myself

Edited by kevinward13

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...