Solved

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

Posted on 2009-05-13
8
758 Views
Last Modified: 2013-11-10
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).
I then need to open this New file *.mht in Excel
CASS-resultspage.doc
CASS-inquirypage.doc
CASS-reportingpage.doc
0
Comment
Question by:SRG041808
[X]
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
  • 8
8 Comments
 

Author Comment

by:SRG041808
ID: 24379106
I have my own username and password (just putting that out there in case the reason I'm not getting any advise/answers is because you think I'm looking for advise on how to hack in.  I can manually get in with my username and password -- just looking for a way to automate this process.)
0
 

Author Comment

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

Author Comment

by:SRG041808
ID: 24384860

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
Login porition taken from solution posted by egl1044 on another question.
0
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 

Author Comment

by:SRG041808
ID: 24385125
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: 24385199
duh... I see my mistake -- I copied and pasted -- without changing strLogin to strInquiry
0
 

Author Comment

by:SRG041808
ID: 24385718
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: 24385740

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: 24386648

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

710 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