Sign in to follow this  
Followers 0
matakana

Marry these 2 pieces of code together?

3 posts in this topic

Hi

I have 2 pieces of code that work well.

I would like to marry them together - I have tried all sorts of ideas - for the last 3 hours - but now

I need your help now please.

The first piece of code opens the web page at a given time (thanks 'JohnOne')

The second piece of code opens the web page and fills in login number and password.

Any help would be sincerely appreciated!

#include <IE.au3>
$sURL = "https://time.dismm.com/DisfkTC/"
Global $oIE

While 1
    If @HOUR = 11 And @MIN = 36 Then
        _start()
    EndIf
    Sleep(1000 * 58)
WEnd

Func _start()
    $oIE = _IECreate($sUrl, 0, 1, 0, 1)
    While 1
        If WinExists("Disson Time & Expense - Login - Windows - Windows Internet Explorer") Then
            WinWaitActive("Disson Time & Expense - Login - Windows - Windows Internet Explorer") ;wait to be active
            Beep(800,200) ;do stuff
            ExitLoop
        EndIf
        Sleep(100)
    WEnd
EndFunc

#include <IE.au3>
$sURL = "https://time.dismm.com/DisfkTC/"
$sEmployeeID = "123456"
$sPassword = "mypassword"
$sDomain = "PDdisDIV"
$oIE = _IECreate($sURL)
$oForm = _IEFormGetCollection($oIE, 0)
$oEmplID = _IEFormElementGetObjByName($oForm, "uid")
$oPass = _IEGetObjById($oForm, "passField")
$oDomain = _IEFormElementGetObjByName($oForm, "sltdom")
sleep(200)
_IEFormElementSetValue($oPass, $sPassword)
send("{ENTER}")
sleep(8000)
_IEFormElementOptionselect($oDomain, $sDomain, 1, "byText")

Share this post


Link to post
Share on other sites



Try

#include <IE.au3>

Global $oIE
$sURL = "https://time.dismm.com/DisfkTC/"
$sEmployeeID = "123456"
$sPassword = "mypassword"
$sDomain = "PDdisDIV"

While 1
    If @HOUR = 11 And @MIN = 36 Then
        _start()
    EndIf
    Sleep(1000 * 58)
WEnd

Func _start()
    $oIE = _IECreate($sURL, 0, 1, 0, 1)
    While 1
        If WinExists("Disson Time & Expense - Login - Windows - Windows Internet Explorer") Then
            WinWaitActive("Disson Time & Expense - Login - Windows - Windows Internet Explorer") ;wait to be active
            _Login()
            ExitLoop
        EndIf
        Sleep(100)
    WEnd
EndFunc   ;==>_start

Func _Login()
    $oForm = _IEFormGetCollection($oIE, 0)
    $oEmplID = _IEFormElementGetObjByName($oForm, "uid")
    $oPass = _IEGetObjById($oForm, "passField")
    $oDomain = _IEFormElementGetObjByName($oForm, "sltdom")
    Sleep(200)
    _IEFormElementSetValue($oPass, $sPassword)
    Send("{ENTER}")
    Sleep(8000)
    _IEFormElementOptionselect($oDomain, $sDomain, 1, "byText")
EndFunc   ;==>_Login

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Thanks JohnOne for the quick reply

However the password does not fill in the edit box.

Perhaps Sleep(200) needs to used before a given line?

..but I am only guessing.

Any ides why it does not work?

thanks again

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