Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Automate Save As dialog in Internet Explorer from a VB6 or .NET App

Posted on 2004-08-06
6
396 Views
Last Modified: 2008-02-01
Hey Experts,

I am trying to automate the process of order retrieval from a customers ASP app using a VB6 app to open up IE , navigate to the customers site, login, then retrieve the orders from the appropriate page.

I coded to the point where I am at the page with the list of orders. I want to automatically save this page locally. I will then be reading each line of the saved page for the link and then navigating to that page and saving that out as a text file for parsing into our SQL server.

The problem I am having is I can not find the documentation tell me how to do the “save as” once I have navigated to the page.
Does IE's object allow this?

Any direction or help would be greatly appreciated.
0
Comment
Question by:DTRON04
  • 2
6 Comments
 
LVL 16

Expert Comment

by:Walter Ritzel
ID: 11742815
Try this:

in the page that you open, create a javascript with this line of code:

document.execCommand("SaveAs");


Hope this helps,

Walter.
0
 
LVL 3

Expert Comment

by:travisjhall
ID: 11745037
I'd need to check my references at work before I could answer the original question. However, I thought I might suggest an easier way around this. I doubt you really need IE to access the site's page that way. If you've got IE6, you've got MSXML 3.0 (or later), which means you can use the HTTPRequest object to send and receive via HTTP without having to worry about a browser.

I'd have to check my references again for the detail, but off the top of my head you would do something like:

Dim request As MSXML2.HTTPRequest
Set request = New MSXML2.HTTPRequest

request.open "POST", "http://customer.server/loginprocessor.asp", False
request.send "data related to login"

request.open "GET", "http://customer.server/orders.asp", False
request.send


And then request.responseText would be a string representation of the order page, and you can just save that into a file the way you would any other string data.

If you want a bit more of a hand with that approach, let me know and I'll have a quick look for more information when I'm back at work tomorrow.
0
 

Author Comment

by:DTRON04
ID: 11751076
Thanks Travis, yeah if you could give me a few links to a good reference for what you explained. I guess it just reads the HTML as a stream?
Do you know if i can save it as a plain text file or use a parser to strip all of the tags?

Thanks again!
0
 
LVL 3

Accepted Solution

by:
travisjhall earned 500 total points
ID: 11817860
Sorry I haven't gotten back to you about this. Work got busy and I didn't get a chance to look at this again for a while.

I was close on the code, but not quite accurate. This is correct:

Dim request As MSXML2.XMLHTTP
Set request = New MSXML2.XMLHTTP

request.open "GET", "http://qstcsds33/Look/template/Pubview.xml", False
request.send

For PUT method requests, you'll have to do a bit of research yourself, because I haven't done that myself. (Although, it might become necessary in the near future for something I have to do here at work.) The request method changes just by using "PUT" instead of "GET", but I haven't read up on the details of the data to be sent with the PUT request.

request.responseStream will indeed present the data to you as a stream. However, you can also get it as a string with request.responseText. If you want to parse it, you basically get one built-in with request.responseXML, as long as what comes back is well-formed XML (and the recent HTML spec, XHTML, does require that HTML be XML).

A decent starting place for more reading is http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/xmobjxmlhttprequest.asp. However, I would suggest tracking down and downloading the whole SDK, as I find it quite useful.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question