Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. sponsors. rss.
 From: Yuri Rubinov
  Where is Yuri Rubinov?
 Philadelphia
 Pennsylvania - United States
 Yuri Rubinov
 To: Ferenc Richard
  Where is Ferenc Richard?
 warsaw
 Poland
 Ferenc Richard
 Tags
Subject: RE: Printing HTML document
Thread ID: 232596 Message ID: 232878 # Views: 23 # Ratings: 0
Version: Visual FoxPro 9 Category: Reports and Printers
Date: Friday, June 26, 2009 5:33:35 PM         
   


You may also review the code below, but I consider it less reliable than the way I mentioned previously: key combination in SendKeys may depend on IE version, etc..


YSaveas(Your_URL,"HTML COMPLETE")


PROCEDURE YSaveas
PARAMETERS lcAddress, lcMode
IF TYPE("LCMODE")#"C" OR NOT INLIST(UPPER(lcmode),"MHT","HTML COMPLETE","HTML ONLY","TXT")
	lcmode="MHT"
ENDIF
lcmode=UPPER(lcmode)
*lcaddress ="http://www.drudgereport.com/flashaot.htm"
	DO case
	CASE lcmode=="HTML COMPLETE"
		lcoutfile = "c:\test.html"
	CASE lcmode=="MHT"
		lcoutfile = "c:\test.mht"
	CASE lcmode=="HTML ONLY"
		lcoutfile = "c:\test.html"
	OTHERWISE
		lcoutfile = "c:\test.txt"
	ENDCASE
	
oIE = CreateObject("InternetExplorer.Application")
oIE.Visible = .T.
CLEAR

oIE.Navigate(lcaddress)
lnstart=second()
do while type('OIE.DOCUMENT.title')#'C' and SECONDS()-lnstart<=15
	WAIT WINDOW TIMEOUT 1.0 "Navigating...."
enddo
IF type('OIE.DOCUMENT.title')#'C'
	?"Failed to navigate..."
	return
endif

oShell = CreateObject("WScript.Shell")
lnstart=second()
do while not oShell.AppActivate(OIE.DOCUMENT.title) and ;
							second()-lnstart <=10
	wait wind time 1.0 "Entering ..."
	?"attempt"
ENDDO

ERASE (lcoutfile)

if oShell.AppActivate(OIE.DOCUMENT.title)
	oShell.SendKeys("%(fa)")
	oShell.SendKeys(lcoutfile)
	DO case
	CASE lcmode=="HTML COMPLETE"
		oShell.SendKeys("{TAB}{DOWN}")
	CASE lcmode=="MHT"
		oShell.SendKeys("{TAB}{DOWN}{DOWN}")
	CASE lcmode=="HTML ONLY"
		oShell.SendKeys("{TAB}{DOWN}{DOWN}{DOWN}")
	OTHERWISE
		oShell.SendKeys("{TAB}{DOWN}{DOWN}{DOWN}{DOWN}")
	ENDCASE
		
	oShell.SendKeys("{ENTER}%s")
	WAIT WINDOW TIMEOUT 1.0 ""
	?"OK"
ELSE
?"????"
endif

oIE.quit
oShell=null


Best Wishes,

Yuri Rubinov



COMPLETE THREAD
Printing HTML document Posted by Ferenc Richard @ 6/24/2009 4:40:00 PM
RE: Printing HTML document Posted by Bilal Budhani @ 6/24/2009 5:08:08 PM
RE: Printing HTML document Posted by Yuri Rubinov @ 6/24/2009 5:44:19 PM
RE: Printing HTML document Posted by Ferenc Richard @ 6/26/2009 3:28:23 PM
RE: Printing HTML document Posted by Yuri Rubinov @ 6/26/2009 3:40:17 PM
RE: Printing HTML document Posted by Ferenc Richard @ 6/26/2009 4:37:26 PM
RE: Printing HTML document Posted by Yuri Rubinov @ 6/26/2009 5:03:34 PM
RE: Printing HTML document Posted by Yuri Rubinov @ 6/26/2009 5:33:35 PM