Solved

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

Posted on 2009-05-13
8
751 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
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
 

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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This video teaches users how to migrate an existing Wordpress website to a new domain.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

863 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

21 Experts available now in Live!

Get 1:1 Help Now