Consultor Eletrônico



Kbase P23041: How to save the contents of a Web Page to a file using Progress 4GL via ActiveX?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   4/24/2009
Status: Unverified

GOAL:

How to save the contents of a Web Page to a file using Progress 4GL via ActiveX?

GOAL:

How to use the execCommand method exposed by the Dynamic HTML (DHTML) Object Model?

FACT(s) (Environment):

Progress 8.x
Progress 9.x

FIX:

DEFINE VARIABLE vchInternetExplorer AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE vchDocument AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE vlOkay AS LOGICAL NO-UNDO.

CREATE "InternetExplorer.Application":U vchInternetExplorer NO-ERROR.
IF ERROR-STATUS:ERROR THEN
RETURN ERROR.
ASSIGN vchInternetExplorer:VISIBLE = TRUE.
NO-RETURN-VALUE vchInternetExplorer:Navigate("www.progress.com":U).
MESSAGE "Saving the Progress main Web Page to a file before exiting Internet Explorer..."
VIEW-AS ALERT-BOX INFO BUTTONS OK.
vchDocument = vchInternetExplorer:Document.
vlOkay = vchDocument:execCommand("SaveAs":U,FALSE,"prgsWebPage.html":U).
MESSAGE "Web Page" IF NOT vlOkay THEN "not" ELSE "successfully" "saved!"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
NO-RETURN-VALUE vchInternetExplorer:QUIT().
IF VALID-HANDLE(vchDocument) THEN
RELEASE OBJECT vchDocument.
ASSIGN vchDocument = ?.
IF VALID-HANDLE(vchInternetExplorer) THEN
RELEASE OBJECT vchInternetExplorer.
ASSIGN vchInternetExplorer = ?.