Hello,

We have a website on our intranet that has frames and text boxes that
we need to populate with data automatically with VBScript. I have
been able to populate other web pages with VBScript when they don't
have frames, but cannot figure out how to populate them when they have
frames.

I have been trying to search the existing posts, but I still can't
seem to get this to work.

I found a website on the Internet that has frames and input boxes that
are similar to our intranet web page.

http://www.iopus.com/iim/demo/frames

Does anybody know how I could use VBScript to populate these text
boxes within the frames? This is the code I have figured out so far:

Const URL = "http://www.iopus.com/iim/demo/frames"
With WScript.CreateObject("InternetExplorer.Application")
.Visible = True
.Navigate URL
Do Until .ReadyState = 4
WScript.Sleep 50 ' wait for page to load
Loop


With .document.forms(1) ' I DON'T KNOW WHAT ELSE GOES HERE TO
REFERENCE TO FRAME
.T1.value = "Hello" ' enter company into a textbox

End With

Would anybody be willing to show me what I am missing in my code?

Thank you in advance,

Shawn

Re: Vbs populate ie web form with frames by Michael

Michael
Tue Oct 21 14:38:45 CDT 2003

Shawn wrote:
> Hello,
>
> We have a website on our intranet that has frames and text boxes that
> we need to populate with data automatically with VBScript. I have
> been able to populate other web pages with VBScript when they don't
> have frames, but cannot figure out how to populate them when they have
> frames.


When you navigate an IE instance to a frameset page, the IE.document is a
reference to the frameset document, not any of the individual frames.

You need to qualify the frame references (each of which is a window object
with its own document property) via the frames collection via the document
or window object.


For example,

set docFrameA = _
IE.document.frames("frameX").document

If you haver nested framsets, then

set docFrameY = _
IE.document.frames("framesetX").frames("frameY").document

Collections
frames Collection (document, window) (Internet Explorer)
http://msdn.microsoft.com/workshop/author/dhtml/reference/collections/frames.asp


>
> I have been trying to search the existing posts, but I still can't
> seem to get this to work.
>
> I found a website on the Internet that has frames and input boxes that
> are similar to our intranet web page.
>
> http://www.iopus.com/iim/demo/frames
>
> Does anybody know how I could use VBScript to populate these text
> boxes within the frames? This is the code I have figured out so far:
>
> Const URL = "http://www.iopus.com/iim/demo/frames"
> With WScript.CreateObject("InternetExplorer.Application")
> .Visible = True
> .Navigate URL
> Do Until .ReadyState = 4
> WScript.Sleep 50 ' wait for page to load
> Loop
>
>
> With .document.forms(1) ' I DON'T KNOW WHAT ELSE GOES HERE TO
> REFERENCE TO FRAME
> .T1.value = "Hello" ' enter company into a textbox
>
> End With
>
> Would anybody be willing to show me what I am missing in my code?
>
> Thank you in advance,
>
> Shawn

--
Michael Harris
Microsoft.MVP.Scripting

Microsoft® Windows®2000 Scripting Guide
http://www.microsoft.com/technet/scriptcenter/scrguide/sagsas_overview.asp

TechNet Script Center Sample Scripts
http://www.microsoft.com/downloads/release.asp?ReleaseID=38942

WSH 5.6 documentation download
http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en