Thanks Dennis - lots to chew on now. Cheers Dave
-----Original Message----- From: Dennis Chuah [mailto:[EMAIL PROTECTED]] Sent: Thursday, 28 November 2002 09:32 To: Multiple recipients of list delphi Subject: Re: [DUG]: Automating Internet Explorer from Delphi Dave, Hi. Firstly, I suggest that you go the this web site: http://www.euromind.com/iedelphi/index.htm and read about the updates shdocvw and mshtml_tlb files. The ones shipped by Borland are incorrect and out of date. Secondly, use the CoInternetExplorer.Create method in shdocvw to create the automation object. This returns the IWebBrowser2 interface, from which you can get access to IHTMLDocument2 via its document property. Depending on which version of IE you want to automate, you have a choice of IHTMLDocument2 .. IHTMLDocument5. The later version support more methods and functions. You can search MSDN (http://msdn.microsoft.com) for more info on the methods and properties. The higher versions support a more direct method of accessing HTML elements. Regards, Dennis. ----- Original Message ----- From: <[EMAIL PROTECTED]> To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]> Sent: Thursday, November 28, 2002 7:58 AM Subject: RE: [DUG]: Automating Internet Explorer from Delphi > Hi Dennis > > I found the uses clause I was looking for - it seems to be MSHTML. So just > using this uses clause, with no Internet components on my form, I wrote the > following code. I'm a bit lost. Can you help, especially with the error > message: > > procedure TMainForm.BitBtn1Click(Sender: TObject); > var > doc: IHTMLdocument2; > elem: IHTMLElement; > IE:Variant; > begin > IE := CreateOleObject('internetexplorer.application'); > IE.Visible := True; > IE.navigate('http://www.somesite.com/information/register/download.asp'); > > doc := IE.document as IHTMLdocument2; > // the above line falls over with: [Error] MainUnit.pas(44): Operator not > applicable to this operand type > // have I defined IE correctly as a variant? > > elem := doc.all.item('id',0) as IHTMLElement; > elem.value := 'MyUserName'; > > // how do I "send" the user name to IE? e.g. elem.click??? > > elem := doc.all.item('pwd',0) as IHTMLElement; > elem.value := 'MyPassword'; > > // now must focus to the "login" button and click it > elem := doc.all.item('LoginBtn',0) as IHTMLElement; > elem.click; > > // click on "download file" hot link > // ??? wonder how this is done??? - same idea as above I guess > > // all finished, so quit IE > IE.Quit; > IE:= UnAssigned; > end; > > Any ideas appreciated. I'm using Delphi 6. > > Cheers > Dave > > > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]] > Sent: Thursday, 28 November 2002 07:07 > To: Multiple recipients of list delphi > Subject: RE: [DUG]: Automating Internet Explorer from Delphi > > > Hi Dennis > > This looks good, however what components are IHTMLdocument2 and IHTMLElement > referring to? Or else what uses clauses do I need? (I had a look under my > Internet tab, but couldn't find components with these names). > > Thanks for your help. > > Dave > > -----Original Message----- > From: Dennis Chuah [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, 27 November 2002 15:47 > To: Multiple recipients of list delphi > Subject: Re: [DUG]: Automating Internet Explorer from Delphi > > > > procedure SetData; > var > doc: IHTMLdocument2; > elem: IHTMLElement; > begin > doc := IE.document as IHTMLdocument2; > elem := doc.all.item('mycontrol',0) as IHTMLElement; > elem.value := 'SomeValue'; > end; > > In the HTML document: > > <form> > <input type="text" id="mycontrol"> > > > HTH > Dennis. > > > ----- Original Message ----- > From: <[EMAIL PROTECTED]> > To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]> > Sent: Wednesday, November 27, 2002 2:44 PM > Subject: [DUG]: Automating Internet Explorer from Delphi > > > > I want to use IE as an OLE Automation server. I've found the events, > methods > > and properties for the IE Object on MSDN. However, I'm having trouble > > finding what I need. I want to go to a particular URL (no problems) and > then > > enter a user name and password, which that page prompts for. Can I get > this > > level of interaction, where I can effectively fill in forms and click > > buttons in IE, on behalf of the user? If so, which events / methods / > > properties should I use and how? > > > > Anyone done this? Any sites recommended? > > > > Cheers > > > > Dave Jollie > > Software Developer BOA IT > > 09 368 4259 ext 6231 > > > > The information contained in this mail message is confidential and may > also > > be legally privileged. If you are not the intended recipient, please note > > that any use, dissemination, further distribution, or reproduction of this > > message in any form what so ever, is strictly prohibited. If the mail is > in > > error, please notify me by return E-mail, delete your copy of the message, > > and accept my apologies for any inconvenience caused. > > > > -------------------------------------------------------------------------- > - > > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] > > Website: http://www.delphi.org.nz > > To UnSub, send email to: [EMAIL PROTECTED] > > with body of "unsubscribe delphi" > > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ > > > -------------------------------------------------------------------------- - > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] > Website: http://www.delphi.org.nz > To UnSub, send email to: [EMAIL PROTECTED] > with body of "unsubscribe delphi" > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ > -------------------------------------------------------------------------- - > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] > Website: http://www.delphi.org.nz > To UnSub, send email to: [EMAIL PROTECTED] > with body of "unsubscribe delphi" > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ > -------------------------------------------------------------------------- - > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] > Website: http://www.delphi.org.nz > To UnSub, send email to: [EMAIL PROTECTED] > with body of "unsubscribe delphi" > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ > --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/