' ------------------------------------------------------------------------------------
' PanoramaApplet.vbs
'
' This script will build a web page for viewing panorama pictures using the
' ptviewer Java Applet from Professor Helmut Dersch (www.fh-furtwangen.de/~dersch/).
' Download first the applet from: http://www.path.unimelb.edu.au/~dersch/ or from
' http://www.fsoft.it/panorama/ptviewer.htm
' Modify the values in the block of const(ants) to suits your configuration and needs.
'
' ------------------------------------------------------------------------------------
Option Explicit
app.ClearTrace
'const ptviewerPath = "D:\HTML\Pano\ptviewer3.1.2.jar" ' Replace by the full path of the applet
const ptviewerPath = "M:\Images\Panorama\ptviewer.jar" ' Replace by the full path of the applet
const titleText = "%AN" ' Display String for page title
const pictureText = "%C8 - %FC (%FK KB)" ' Display String for the picture link (in the selection list)
const commentText = "%C8 - %FC
%C1 %LE[%C2,5]" ' Display String for the picture comment
const bShowInstruction = True ' Display a short text on how to use the applet at the bottom of the page
const pageField = "Lieu" '
const hotSpotField = "hotspots" '
Dim alb, pic, picNew, fso, f, k, nbP
set alb = app.GetCurrentAlbum
Dim sOutputPath, outputFileName, outputBaseFileName, sTitle
' Using the album folder as the default output folder
sOutputPath = alb.ExpandMacro( Nothing, "%Af" )
sOutputPath = app.GetFilename( "Select the output folder (default is the album folder)", 2, sOutputPath, "", 0 )
app.trace "Output folder is: " & sOutputPath, -1, TRACE_INFORMATION
outputBaseFileName = "index.htm" 'InputBox( "Please enter the name of the HTML file to create", "StereoscopeApplet generator", "StereoscopeApplet.html")
outputFileName = sOutputPath & "\" & outputBaseFileName
app.Trace "Output file = " & outputFileName, -1, TRACE_INFORMATION
' Copy of the ptviewer Applet java archive in the output folder
Set fso = CreateObject("Scripting.FileSystemObject")
set f = fso.GetFile( ptviewerPath )
f.copy sOutputPath & "\" & "ptviewer.jar"
set f = Nothing
Const ForReading = 1, ForWriting = 2
Dim nbPic, i, w, kR, nbSelPic, sFirstPic, s, sCmt, sFile, rcCrop, sPreviewFile, sLine
nbPic = alb.nbPicture
nbSelPic = alb.nbSelectedPicture
app.Trace "Pictures selected in this album: " & nbSelPic, -1, TRACE_INFORMATION
' First find all the pages
Dim tabPages(), tabPicPages(), nbPages, bAddPage, j
nbPages = 0
if pageField <> "" then
for i=0 to nbPic-1
Set pic = alb.GetPicture(i)
if not pic is Nothing and pic.bSelected then
s = pic.GetCustomField( pageField )
if s <> "" then
bAddPage = True
for j = 0 to nbPages-1
if tabPages(j) = s then
tabPicPages(j) = tabPicPages(j) + 1
bAddPage = False
end if
next
if bAddPage then
nbPages = nbPages + 1
redim Preserve tabPages(nbPages)
redim Preserve tabPicPages(nbPages)
tabPages(nbPages-1) = s
tabPicPages(nbPages-1) = 1
end if
end if
end if
next
app.Trace "Found " & nbPages & " pages:"
for j = 0 to nbPages-1
app.Trace vbTab & tabPages(j) & vbtab & tabPicPages(j) & " pictures"
next
end if
Set f = fso.OpenTextFile( outputFileName, ForWriting, True)
f.WriteLine ""
f.WriteLine ""
f.WriteLine "
Instructions: | |
"
f.WriteLine "
| "
f.WriteLine ""
f.WriteLine " | "
f.WriteLine "