Sign in to follow this  
Followers 0
kevinward13

rerun the function

2 posts in this topic

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

    $oIE = _IECreate ("page") ; 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.
        
    $sWindowTitle = "Remedy Mid Tier 6.3 - Login - Windows Internet Explorer provided by company"
    $sErrorTitle = "Remedy Mid Tier 6.3 - Error page -" ; Windows Internet Explorer provided by company"
    $sErrorText = "Incorrect login parameters. Web page, user, and/or server name(s) must be provided."
    $oIE2 = "page"
        
    $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
    
    Sleep(5000)
        If WinExists ($sErrorTitle) Then
            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
        EndIf
        
EndFunc ; ########## End of Function to log into Web Remedy ##########

Ok im stuck. Code works great but sometimes I get the error page of bad username/password/login server. The code sees the page and popsup the MsgBox like it should. However i would like to to rerun the function again until a successful logon/in. I have tried the IF statements and the while statements. I tried the _RemedyLogin() call to the function again. no go. i know you smart peeps out there have the answer

Share this post


Link to post
Share on other sites



On successful login, does the window title change to something unique like "Logged In"? If so, just call your function in a do/until. Use winexists to look for that title. If successful, use exitloop.


#include <ByteMe.au3>

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