Solved

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

Posted on 2009-05-13
8
749 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
  • 8
8 Comments
 

Author Comment

by:SRG041808
Comment Utility
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
Comment Utility
ok.. I finally got the Login part... proceeding on to step 2...  
Help is still greatly appreciated!!
0
 

Author Comment

by:SRG041808
Comment Utility

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
 

Author Comment

by:SRG041808
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

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

Author Comment

by:SRG041808
Comment Utility
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
Comment Utility

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
Comment Utility

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now