Solved

VBSCRIPT: Login to .asp page, 'Click' on Inquiry, Enter multiple invoice numbers in box, submit, print report

Posted on 2009-05-14
8
616 Views
Last Modified: 2013-12-08
I am Completely new to interfacing with IE  (besides manually :-)
and the searches I have performed to try and learn what I need for my project haven't helped me.
The first and most important part of this question is my being able to login to this 'portal'.  Again, none of the searches I've performed to figure this out have helped. (part of it might be I don't know the correct terminology to use).  I thought I had found one example that might help me -- but it just refreshes the page leaving the username and password blank.  I think it might have something to do with it being an .asp page?

To make a long story short - Below is what I need to do.  Please help.  Again - the login portion is the most important -- as I have not found ANY references to this that can help me.

I need to login to https://my.cassport.com/CISFBSYS/Login/login.asp
Which will bring up the Reporting Page (see CASS_reportingpage.doc)
At this point I need to "click" on INQUIRY, which will bring up the Inquiry Page (see CASS_inquirypage.doc)
Then I need to loop through a Text file a MAX of 25 times and place the Invoice number in the box provided. (The search allows for 25 invoice numbers to be queried at one time).
Once 25 or Less invoice numbers have been entered into the box, I need to "click" on Search button.
The results are then returned (see CASS_resultspage.doc)
In the bottom right-hand of the screen there is a Print button.  I need to click this button (not Print from the File menu).  A box then opens stating that a New Window will be opened.  I have to click OK, and then the process opens the New Window.
I need to then take the New Window and from IT'S File menu, select Print and save the file as a Web Archive, single file (*.mht).
CASS-inquirypage.doc
CASS-reportingpage.doc
CASS-resultspage.doc
0
Comment
Question by:SRG041808
  • 8
8 Comments
 

Author Comment

by:SRG041808
ID: 24384815

ok.. I finally got the Login part... proceeding on to step 2...  
Help is still greatly appreciated!!
0
 

Author Comment

by:SRG041808
ID: 24384829
as info -- here is my script so far  (Only have the login down :-)

strLogin = "https://my.cassport.com/CISFBSYS/Login/login.asp
Set oie = CreateObject("InternetExplorer.Application")
oie.Visible = True
oie.Navigate (strLogin)
While oie.Busy: Wend ' wait for page to load...
oie.Document.Forms(0).txtLoginID.Value = "user"
oie.Document.Forms(0).txtPassword.Value = "pword"
oie.Document.Forms(0).submit
0
 

Author Comment

by:SRG041808
ID: 24384849
Login porition taken from solution posted by egl1044 on another question.
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:SRG041808
ID: 24385155

Now - I try to navigate to the Inquiry page so I can enter my invoice numbers -- and it pulls the login.asp back up.
I simply added the following to the above script:
strInquiry = "https://my.cassport.com/CISFBSYS/Inquiry/Inquiryfs.asp?Type=C"
oie.Navigate (strLogin)  
0
 

Author Comment

by:SRG041808
ID: 24385201
duh... I see my mistake -- I copied and pasted -- without changing strLogin to strInquiry
0
 

Author Comment

by:SRG041808
ID: 24385720

Figured out everything else -- Now need to access FILE menu in IE, Choose SAVE AS, and Save the page as filename.MHT (Web Archive, single file (*.mht)
 
0
 

Author Comment

by:SRG041808
ID: 24385736

Dim strLogin 'As String
strLogin = "https://my.cassport.com/CISFBSYS/Login/login.asp
'
Set oie = CreateObject("InternetExplorer.Application")
'
oie.Visible = True
oie.Navigate (strLogin)
'
While oie.Busy: Wend ' wait for page to load...
'
oie.Document.Forms(0).txtLoginID.Value = "user"
oie.Document.Forms(0).txtPassword.Value = "pass"
oie.Document.Forms(0).submit
strInquiry = "https://my.cassport.com/CISFBSYS/Inquiry/InquirySearch.asp?Type=C"
oie.Navigate (strInquiry)
While oie.Busy: Wend ' wait for page to load...
'invoice numbers will be variables that are set from a text file...
oie.Document.Forms(0).txtNumbers.Value = "1009046354" & Chr(13) & "1431006428"
oie.Document.Forms(0).submit
'
'invoice numbers will be variables that are set from a text file...
strPrint = "https://my.cassport.com/CISFBSYS/Inquiry/Inquiryprint.asp?txtNumbers=1009046354%2C1431006428&InquiryType=P&Type=C&SuffixSelect=S&print=1"
'
oie.Navigate (strPrint)
'
'NEED CODE TO DO FILE-SAVEAS .MHT FILE
Set oie = nothing
0
 

Accepted Solution

by:
SRG041808 earned 0 total points
ID: 24386645

How can I specify which File type to select when trying to save a WEB Page? I want it to save as an MHT.  (I've added some sendkeys to the code to save the web page -- but I can't figure out how to change the filetype to Web Archive (.mht).
Dim strLogin 'As String
strLogin = "https://my.cassport.com/CISFBSYS/Login/login.asp
'
Set oie = CreateObject("InternetExplorer.Application")
'
oie.Visible = True
oie.Navigate (strLogin)
'
While oie.Busy: Wend ' wait for page to load...
'
oie.Document.Forms(0).txtLoginID.Value = "user"
oie.Document.Forms(0).txtPassword.Value = "pass"
oie.Document.Forms(0).submit
strInquiry = "https://my.cassport.com/CISFBSYS/Inquiry/InquirySearch.asp?Type=C"
oie.Navigate (strInquiry)
While oie.Busy: Wend ' wait for page to load...
'invoice numbers will be variables that are set from a text file...
oie.Document.Forms(0).txtNumbers.Value = "1009046354" & Chr(13) & "1431006428"
oie.Document.Forms(0).submit
'
'invoice numbers will be variables that are set from a text file...
strPrint = "https://my.cassport.com/CISFBSYS/Inquiry/Inquiryprint.asp?txtNumbers=1009046354%2C1431006428&InquiryType=P&Type=C&SuffixSelect=S&print=1"
'
oie.Navigate (strPrint) '
Set objShell = CreateObject("WScript.Shell")
objShell.AppActivate "Cass Information Systems - Windows Internet Explorer"
objShell.SendKeys "%F"
WScript.sleep 100
objShell.SendKeys "A"
WScript.sleep 100
'will actually send filename variable
fn = "newtestfile"
objShell.SendKeys fn
WScript.sleep 100
objShell.SendKeys "%S"
WScript.sleep 100
objShell.SendKeys "Y"
'
Set oie = nothing
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
SSL stands for “Secure Sockets Layer” and an SSL certificate is a critical component to keeping your website safe, secured, and compliant. Any ecommerce website must have an SSL certificate to ensure the safe handling of sensitive information like…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.

791 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