Sign in to follow this  
Followers 0
matakana

Click on button help

4 posts in this topic

#include <IE.au3>

$sURL = "https://time.urscorp.com/DeltekTC/"

$sEmployeeID = "123456"

Hi I a newbie here - so sorry for clumsy and naive questions.

Someone from this forum supplied with the the code shown below

about 3 years ago. It works great, however now I would like to improve

it. When the web page opens up the password is inserted and a second web page

opens up requiring the user to single or double click a button which is called "Timesheet"

I have tried to find the property (in the web page source code)of this button and I think it

is called id == "Timesheet". Is that enough information to add to my code below.

I would sincerely appreciate it if someone could help me out

cheers Matakana

$sPassword = "mypassword"
$sEmployeeID = "123456"
$sDomain = "PDURSDIV"

$oIE = _IECreate($sURL)
$oForm = _IEFormGetCollection($oIE, 0)
$oEmplID = _IEFormElementGetObjByName($oForm, "uid")
$oPass = _IEGetObjById($oForm, "passField")
$oDomain = _IEFormElementGetObjByName($oForm, "sltdom")
sleep(400)
_IEFormElementSetValue($oPass, $sPassword)
send("{ENTER}")

sleep(8000)

_IEFormElementOptionselect($oDomain, $sDomain, 1, "byText")

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

This should get you started...

#include <IE.au3>

Global $oIE, $oForm, $colButtons, $btnTimeSheet, $oTimeSheet

$sPassword = "mypassword"
$sEmployeeID = "123456"
$sDomain = "PDURSDIV"

$oIE = _IECreate($sURL)
$oForm = _IEFormGetCollection($oIE, 0)
$oEmplID = _IEFormElementGetObjByName($oForm, "uid")
$oPass = _IEGetObjById($oForm, "passField")
$oDomain = _IEFormElementGetObjByName($oForm, "sltdom")
sleep(400)
_IEFormElementSetValue($oPass, $sPassword)
send("{ENTER}")

sleep(8000)

_IEFormElementOptionselect($oDomain, $sDomain, 1, "byText")

_ClickBtn_TimeSheet() ; Run click button function

Func _ClickBtn_TimeSheet()
    ;
    
    ;
    $oIE = _IEAttach ("IE Webpage Window Title") ;<<< Change to webpage window title where button is located 
    $oForm = _IEFormGetObjByName ($oIE, "IE Form Name") ;<<< Change to form name on webpage where button is located
    
    $colButtons = _IETagNameGetCollection($oIE, "button")
    
    ;IE Webpage Buttons
    $btnTimeSheet = "Timesheet" ;<<< Change to button name
    
    For $oButton In $colButtons
        If $oButton.id = $btnTimeSheet Then $oTimeSheet = $oButton      
    Next
    
    _IEAction ($oTimeSheet, "click")
EndFunc     ;_ClickBtn_TimeSheet

jfcby

Edit: modify code

Edited by jfcby

Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB ****

Share this post


Link to post
Share on other sites

Smart comment: Sure beats asking somebody to punch in for you when you are taking a sickie!

Share this post


Link to post
Share on other sites

thanks jfcby

I have not got it working yet. A maybe dumb question?

- but what is and where is

"form name on webpage where button is located"?

I understand where 'webpage window title' is and button name is simply "Timesheet"

cheers Matakana

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