I have a rusty background in programming so after spending hours trying code and re-searching the forums and the Help, I've decided I better take a nap and ask for help.
I am opening an IE insurance claim screen, then switching over to an excel spreadsheet to get some data. Pop back over to the IE and populate the fields and submit. (In the grand scheme of things, I'll somehow capture the output, (or open a dialogue (Gui) to have the user get what I need); then loop back to the excel and do it again.
I can handle the excel part. What has been torturing me is how to populate the IE using tags or whatever with ControlSend. I can make it work with clicks and tabs, but I thought the ControlSend would be more precise. I'm missing the syntax or this IE form doesn't have what I need.
Under the code is the output from the diags statements, which I thought would show me the Input fields. I've tried a dozen different variants of the ControlSend with the "Input tags" (or whatever they are) - but I'm exhausted. Something isn't clicking in MY head.
#include <IE.au3>
#include <Excel.au3>
; Check for an IE Claim window already signed on and open - if not there, open one
If Not (WinExists("[CLASS:IEFrame]", "Claim Inquiry - Windows Internet Explorer")) Then
MsgBox(0, "IE", "Window does not exist - open it")
Local $oInternet = ObjCreate("InternetExplorer.Application")
$oInternet.Navigate("https://www.insurance.com/logon.xhtml") ; Opening a web page that contains a form
$oInternet.Visible = 1 ; Let the guy show himself
WinWaitActive("Log on - Windows Internet Explorer")
Local $oDoc = $oInternet.document ; Example object to test
Local $oForm = $oDoc.forms(0) ; Example object to test
;Put this in for my own clarification - which hasn't helped
;MsgBox(0, "", "Interface name of $oInternet is: " & ObjName($oInternet) & @CRLF & _
; "Object name of $oInternet is: " & ObjName($oInternet, 2) & @CRLF & _
; "Interface name of $oDoc is: " & ObjName($oDoc) & @CRLF & _
; "Object name of $oDoc is: " & ObjName($oDoc, 2) & @CRLF & _
; "Interface name of $oForm is: " & ObjName($oForm) & @CRLF & _
; "Object name of $oForm is: " & ObjName($oForm, 2))
Local $handle = WinGetHandle("[CLASS:IEFrame]") ; thought if I started understanding handles, I could grab an already open IE window
WinActivate ("Log on - Windows Internet Explorer")
;error check
WinWaitActive("Log on - Windows Internet Explorer")
;error check
send("signon{TAB}password")
sleep(2)
send("{Enter}")
sleep(5); allow time for signon
; go to claim page
$oInternet.Navigate("https://www.insurance.com/inquiry.xhtml") ; Opening a web page that contains a form
;error check
Else; Claim Window already open
MsgBox(0,"IE","Claim window already open")
local $oInternet = ObjGet("","Claim Inquiry - Windows Internet Explorer") ; Get an existing window
Local $handle = WinGetHandle("[CLASS:IEFrame]", "Claim Inquiry - Windows Internet Explorer")
MsgBox(0, "Handle", $handle)
EndIf
#cs ---> Run through info in an excel sheet
#ce<--------------
; back to IE
WinActivate ($handle)
WinWaitActive ($handle)
Opt("MouseCoordMode", 2) ;1=absolute, 0=relative, 2=client
ControlClick($handle, "", "", "Left", 1,187, 214); click into open field
;************** Am using Sends or ControlSends, but would like to use ControlSend with a Tag
;Send($Excel_ID)
;Send("{TAB 6}")
;Send($Excel_SD & "{TAB}" & $Excel_SD)
;Send("{Enter}")
; OR
;ControlSend( $handle, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", $Excel_ID)
;sleep(3)
;ControlSend( $handle, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{TAB 6}")
;************* How do I specify the edit area to send to rather than tabbing?
; On a side note
;********** These work if I create the IE object but fail if the window is already open
;********** What am I doing wrong?
ConsoleWrite("_IETagNameGetCollection Start --------------------------------------------------------"&@CRLF)
local $oInputs = _IETagNameGetCollection($oInternet, "Input")
For $oInput in $oInputs
consolewrite(string($oInput.id) & @CRLF)
Next
ConsoleWrite("_IETagNameGetCollection Stop --------------------------------------------------------"&@CRLF&@CRLF)
ConsoleWrite("_IEFormGetCollection Start --------------------------------------------------------"&@CRLF)
$oforms = _IEFormGetCollection($oInternet,-1)
For $oform In $oforms
ConsoleWrite($oform.id & @CRLF);
$oeles = _IEFormElementGetCollection($oform)
For $oele In $oeles
ConsoleWrite(@TAB & 'Name: ' & $oele.id & ' Tag Type: ' & $oele.tagName &@CRLF)
Next
Next
ConsoleWrite("_IEFormGetCollection Stop --------------------------------------------------------"&@CRLF&@CRLF)
ConsoleWrite("_IETagNameAllGetCollection Start --------------------------------------------------------"&@CRLF)
Local $oElements = _IETagNameAllGetCollection($oInternet)
For $oElement In $oElements
;MsgBox(0, "Element Info", "Tagname: " & $oElement.tagname & @CR & "innerText: " & $oElement.innerText)
consolewrite("Tagname: " & $oElement.tagname & @CR & "innerText: " & $oElement.innerText & @CRLF)
Next
ConsoleWrite("_IETagNameAllGetCollection Stop --------------------------------------------------------"&@CRLF)
------------------------------------------------------------------- Ouput from Diags - the fields I want to populate should be the RID, FromDOS and ThruDOS
_IETagNameGetCollection Start --------------------------------------------------------
sakClaim
RID
CLMICN
0
0
CLMICN
FromWarrant
FromDOS
ThruWarrant
ThruDOS
_IETagNameGetCollection Stop --------------------------------------------------------
_IEFormGetCollection Start --------------------------------------------------------
clmInq
Name: sakClaim Tag Type: INPUT
_IEFormGetCollection Stop --------------------------------------------------------
_IETagNameAllGetCollection Start -------------------------------------------------------- *** This is an abbreviation, but the blue part is what I will be trying to automate the capture of down the road. If anyone has the time to point me to an example, I'd appreciate it also ***
Tagname: !
innerText: 0
Tagname: HTML
innerText: Claim Inquiry
Main Claims Eligibility Pricing Prior Auth Budgets Trade Files Account Mailbox Help Log Off .
Tuesday 19 November 2013 10:46 am
Claim Inquiry: XXXXXX500D
CriteriaMember ID Claim Status Any Status Denied Paid Suspended Resubmit Claim Type Any Inpatient Outpatient Home Health Long Term Care Crossover - Inpatient Crossover - Outpatient Professional Crossover - Professional Dental Pharmacy Compound Drug
Patient Acct. # Date Type: Date of Service Warrant Date
ICN From Date Thru Date
Search
**** Here is what I will want to scrape - eventually ****
ICNMember IDPatient Acct. #Claim TypeFrom DateThru DateWarrant DateBilled AmountWarrant Amount Status
X999998X
4814976
M############ Professional 20130708 20130708 20130717 31.12 0 Denied
X999999X
4971686
M############ Professional 20130708 20130708 0 31.12 31.12 Paid
PreviousNext
----------------------------------------------------------