Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Irritating issues with Internet Explorer

Status
Not open for further replies.

TBreak

Programmer
Jun 25, 2003
15
GB
If any one out there has managed to stop the print & save dialogue boxes from being displayed could they PLEASE contact me.

I am writing an automation process using IE6. I am using an OLEVariant and all other features of the app are perfect, except the print & save functions, which require confirmation each time. I am using the execCommand method, in which I am setting the display dialog parameter to False, as well as setting the application objects Silent property to True as well! Still the dialogs appear. :-((

As the system design is to be unattended it is crucial I find some fix/way around. Here is an example of what I am doing:

procedure TForm1.btnTestClick(Sender: TObject);

var
ovIE: OLEVariant;

begin
ovIE:=CreateOLEObject('InternetExplorer.Application');
Try
ovIE.Visible:=True;
ovIE.Silent:=True;
ovIE.Navigate(' Repeat
Sleep(250);
Until Not ovIE.Busy;
{...
Do my processing of required pages
...}
ovIE.Document.execCommand('Print',False,Null); {Same prob with save command!}
Except
ovIE.Quit;
End;
end;

ANYONE with ANY ideas of how I might fix or get around the problem PLEASE PLEASE contact me. The program is only waiting for this issue and it can be implemented.

TIA
Ian.
 
Hi,
what about using the TWebBrowser to load your page instead of using IE6?

Maybe if you've made all the rest, you can use it just for print.

Ciao,
Geppo Darkson.
 
Right, I tried that and it did work for the print! But as per usual it won't cure what ails me because:

I need to access java script procedures within the pages I am accessing. I can do this via the OLEVariant but (dunno why) not throught the IDispatch of the TWebBrowser component.

eg. In one of the pages there is a procedure called doSubmitForm()
Using the above code I just do ovIE.Document.doSubmitForm() but I get a compiler error when I use WebBrowser1.Document.doSubmitForm()

If I could get the Save method of the OLEObject instance to work without prompting me then I could do this. Anyone any other ideas?

TIA

Ian.
 
SOLVED IT! :)

Stupidly simple as it happens. All I needed to do was typecast the document property of the TWebBrowser with OLEVariant and hey-presto!

OLEVariant(WebBrowser1.Document).doSubmitForm() accesses the pages java routine.

Sweet. Hope this helps some1 else in future. It was a pain working it out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top