I regularly enter data to a third party database. I’m trying to make a simple VBscript that will lift data from my own Excel spreadsheet and place it in the third party entry form on internet explorer. The process is working except when I get to an iframe on the entry form. Would really appreciate any help on this. I’m a novice.
I need the form to already be open before I launch the VBS (long story) so my script needs to look for the open page. I found a script that does this already. I’ve created a demo entry system, it goes like this:
index.htm
<html>
<body>
<p>First input box is on the_index.htm (main document).</p>
<input id="title" name="title-1" style="width: 220px;" title="enter title" type="text" value="">
<br /><br /><br /><br />
<iframe frameborder="0" id="input_frame" marginheight="0" marginwidth="0" name="input_frame" src="the_iframe.htm">
</body>
</html>
the_iframe.htm
<html>
<body>
<p>Second input box is on the_iframe.htm (iframe called from the main document).</p>
<input id="title" name="title-1" style="width: 220px;" title="enter title" type="text" value="">
</body>
</html>
then my VBS is currently looking like this (sadly the the demo htms have to be hosted, so that the script can find the page (see the first line):
inputscript.vbs
surl ="http://www.website.com/index.htm"
set ie = nothing
set shapp=createobject("shell.application")
on error resume next
For Each owin In shapp.Windows
if left(owin.document.location.href,len(surl))=surl then
if err.number = 0 then
set ie = owin
end if
end if
err.clear
Next
on error goto 0
if ie is nothing then
wscript.echo "Window Not Open"
else
IE.Document.All.Item("title").Value = "wheee1"
IE.Document.frames("input_frame").All.Item("title").Value = "wheee2"
end if
The “wheee1” deployment works fine, but the wheee2 generates ‘object doesn’t support this property or method: ‘ie.document.frames(…).All’. If I get rid of the ‘.All’ then the error is ‘member not found’.
Can anyone tell if there’s a simple fix here?
You could get just frame window through
IE.Document.frames("input_frame"). Since it’s not a document, you need to includeDocumentfor this addressing too.