Purepage - the best way to share information online

Contact   ::  Privacy policy   ::  About us

Products menu Download menu Support menu Buy menu

 Purepage Server

 Purepage SDK

 Purepage for Documentum

 Purepage Server

 Purepage SDK

 Home

 Frequently Asked Questions

 Online Documentation

 Purepage Server Pricing

 Purepage SDK Pricing

 OEM Information

 

See how it works

Supported Formats

Q & A

System Requirements

Download & Try

Licensing & Pricing

OEM Licensing

Buy Online

Purepage SDK
Publish Folder (Beginner)

Written in VBScript for the Windows Scripting host.

This sample builds upon the SIMPLE.VBS and PROPERTIES.VBS samples and demonstrates a more real-world use of Purepage SDK.  This sample can be found in the Basic\Scripts sub-folder when you download the trial version of Purepage SDK.

This sample enumerates the files within a specified folder and converts all Microsoft Word, Excel and PowerPoint files into HTML.  This sample is designed to run in conjunction with the Windows Scheduling service and to provide the basis of an automated Intranet publishing solution.

Main points of interest include:

  • Demonstrates the power that Purepage SDK can provide in a real-world scenario with only a few lines of scripting code!
  • Demonstrates the totally automated publishing of documents into HTML.
  • Can be expanded upon to solve a real-word problem.
  • Uses more complicated VBScript code.


' Windows Script Host Sample Script
'
' This sample demonstrates a more complex example of Purepage use. This example
' converted the all Microsoft Word files in the specified directory into HTML.  You
' can use this example in conjunction with Windows Scheduler to schedule regular
' conversion and publishing jobs.


' Declare some basic variables for later use.

Dim PPServer
Dim JobName
Dim ErrorCode
Dim fso, f, f1, fc, s
Dim Path

' Change this following line to point to the folder you
' have installed the Purepage samples on your computer:

Path = "C:\Program Files\PurePage\samples\"

' Create a Purepage PPServer object.
Set PPServer = WScript.CreateObject("PurePage.PPServer")

' Create a VBScript file object and use it to look at the
' current folder and get a list of files in this folder,
' then we convert each of these files (only the ones that
' are Microsoft Office files) to HTML.

Set fso = WScript.CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(Path & "Documents")
Set fc = f.Files

' Step through the list of files in the folder.
For Each f1 in fc

  ' Make sure the file is a Microsoft Office document by
  ' checking the file extenstion.
  If ((InStr(LCase(f1.name), ".doc") > 0) Or (InStr(LCase(f1.name), ".xls") > 0) Or (InStr(LCase(f1.name), ".ppt") > 0)) Then

    ' Lock the Purepage printer, print a document and
   ' get the printed job name for the printed document.

   PPServer.StartPrint
   PPServer.PrintFiles 0, Path & "Documents\" & f1.name & vbCrLf, 1
   JobName = PPServer.GetLastPrintedJob
   PPServer.StopPrint

   ' Convert the printed job to HTML.
   ErrorCode = PPServer.ConvertPrintedJobToHTML(JobName, 0, 0)
   PPServer.DeletePrintedJob JobName
   PPServer.CleanPrintQueue

  ' Handle any errors that occur during conversion.
   If (ErrorCode <> 0) Then
     ErrorStr = PPServer.GetErrorString(ErrorCode)
     MsgBox ErrorStr
   End If

  End If

Next

' Destroy (free memory) of the objects.
Set PPServer = Nothing
Set fso = Nothing

<< Previous Example       Next Example >>

 

 See how it works...

 Scripting Examples

 HTML Rendition Samples

 Supported Document Formats

 

 

Download and try the 15-day trial.

© 2001 - 2003 Inzone Software Limited. All Rights Reserved.

Contact : Privacy Policy : About Us