I have a web page that I'd like to push data from a database into.
One input box has this when inspecting the element:
<INPUT id=ctl00_ContentPlaceHolder1_IncentiveClaimStep11_txtVIN style="WIDTH: 200px; TEXT-TRANSFORM: uppercase" maxLength=17 name=ctl00$ContentPlaceHolder1$IncentiveClaimStep11$txtVIN>
So let's say I have an access database called Mydata.mdb, with a table called Main, and a field called VIN that needs to get pushed into that box...
What is my starting point?
The entire page has many references to javascript, and there is about 25 input boxes for me to populate.
For querying the database I recommend ADO: http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+Tutorials/OLE~TUTORIAL+ADO.txt
For inputting information into a webpage, check out:
http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/OLE~COM~ADO~CDO~ADSI~LDAP/OLE~with~MSIE/User~Samples+Search~Craigslist.txt
http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/OLE~COM~ADO~CDO~ADSI~LDAP/OLE~with~MSIE+!!~Webpage~Element~Explorer~!!.txt
If you need further assistance, please post the entire Form source from the webpage you are trying to access.
Thanks.... :)
Here is the webpage code...it's inaccessible unless you are on our IP range.
Had to split it because of the file size.
Getting the data out of the database I have down, Just getting it into the page is the mystery
Are you familiar with your browsers F12 web developer tool? You will need to determine the Id of the control you are trying to input data to.
Assuming you determine the ID of the input element on the page. The code might look something like this:
#DefineFunction udfIEPageLoadWait( objIE )
; Wait for webpage to load
While !(objIE.readyState == 'complete' || objIE.readyState == 4 )
TimeDelay(0.1)
EndWhile
While !(objIE.document.readyState == 'complete' || objIE.document.readyState == 4 )
TimeDelay(0.1)
EndWhile
Return 1
#EndFunction
inputid = 'ctl00_ContentPlaceHolder1_IncentiveClaimStep11_calDeliveryDate_dateInput'
oIE = ObjectCreate("InternetExplorer.Application")
oIE.visible = @TRUE
url = 'C:\TEMP\webpage1.html'
oIE.Navigate(url)
udfIEPageLoadWait(oIE)
oElement = oIE.Document.GetElementById(inputid)
oElement.Value = 'WinBatch Rocks'
Exit
IE and the page will already be open and I have to click a disclaimer box:
Try my previously posted code sample but pass that elements ID instead.
Also you are dealing with a checkbox rather than an text input. So you might try setting its value to @TRUE:
#DefineFunction udfIEPageLoadWait( objIE )
; Wait for webpage to load
While !(objIE.readyState == 'complete' || objIE.readyState == 4 )
TimeDelay(0.1)
EndWhile
While !(objIE.document.readyState == 'complete' || objIE.document.readyState == 4 )
TimeDelay(0.1)
EndWhile
Return 1
#EndFunction
inputid = 'ctl00_ContentPlaceHolder1_IncentiveClaimStep11_chkAcknowledge'
oIE = ObjectCreate("InternetExplorer.Application")
oIE.visible = @TRUE
url = 'C:\TEMP\webpage1.html'
oIE.Navigate(url)
udfIEPageLoadWait(oIE)
oElement = oIE.Document.GetElementById(inputid)
oElement.Checked = @True
Exit
See Also: http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsrch.web+WinBatch/OLE~COM~ADO~CDO~ADSI~LDAP/OLE~with~MSIE+TechHome/WinBatch/OLE~COM~ADO~CDO~ADSI~LDAP/OLE~with~MSIE#