'---------------------------------------------------------------------------- ' HTML-TIME-Slideshow.vbs ' This is a HTML slideshow generator written in VBScript. ' It generates a slideshow from the selected pictures of the current album. ' The HTML code uses the new HTML+TIME (Timed Interactive Multimedia Extensions) ' Microsoft Internet Explorer 5.5 or later is needed to view the slideshow. ' This script should not be used on large slideshow as IE loads all the ' pictures in memory... '---------------------------------------------------------------------------- Option Explicit app.ClearTrace Dim alb, pic, nbPic, nbPicV, i, k, outputFileName, picFile, duration Dim bAutoRepeat, sList, kT, bUseSelectionList, sListElemDS, sCommentDS ' Retrieve info on the current album set alb = app.GetCurrentAlbum nbPic = alb.nbSelectedPicture nbPicV = alb.nbVisiblePicture Const ForReading = 1, ForWriting = 2 bAutoRepeat = True if vbNo = MsgBox( "Build an auto-repeat slideshow ?", vbYesNo or vbQuestion, "HTML+TIME slideshow") then bAutoRepeat = False bUseSelectionList = True if vbNo = MsgBox( "Generate a selection drop-down list ?" & vbCrLf & "(Will not work well if picture durations are less than a second)", vbYesNo or vbQuestion, "HTML+TIME slideshow") then bUseSelectionList = False ' Text for the list items (default: first line of picture comment) and the comment sListElemDS = "%1C" sCommentDS = "%FC" ' Create a new HTML file for output Dim fso, f, m Set fso = CreateObject("Scripting.FileSystemObject") outputFileName = InputBox( "Please enter the name of the HTML file to build", "HTML+TIME slideshow", "d:\temp\AlbTime.html") app.Trace "Creating output file '" & outputFileName & "'..." Set f = fso.OpenTextFile( outputFileName, ForWriting, True) ' Build header of the HTML page f.WriteLine "" f.WriteLine "" f.WriteLine "" f.WriteLine "" f.WriteLine "" & alb.sAlbumTitle & "" f.WriteLine " " ' The "time" style is used to apply the "time2" behavior to HTML elements 'f.WriteLine "" f.WriteLine "" ' Function for pausing and restarting the slideshow f.WriteLine "" f.WriteLine "" f.WriteLine "
" f.WriteLine "" & alb.sAlbumTitle & "" if alb.sAlbumComment <> "" then f.WriteLine "
" & alb.sAlbumComment & "" f.WriteLine "" ' Here starts the IE5.5 specific HTML code f.WriteLine "" f.WriteLine " " ' Process all the selected pictures k = 1 kT = 0 for i=0 to nbPicV-1 Set pic = alb.GetVisiblePicture(i) if pic.bSelected then app.trace pic.sFileName picFile = alb.ExpandMacro( pic, "%RP" ) ' Retrieve the duration from the picture if it is define, if not take the ' default value from the album (values in 1/10 of s). duration = pic.lTransition and &hffff if duration = 65535 then duration = alb.nDelaySlideshow duration = duration / 10 if bUseSelectionList then sList = sList & " s += '';" & vbCrLf 'app.Trace " " & kT & "-->" & ceil(kT) kT = kT + duration end if ' Include the picture and its comment in a span that have the "time" style ' The Begin of the span will also update the frame counter f.Write " " f.Write "
pic.h then f.WriteLine " width=""90%"">" else f.WriteLine " width=""50%"">" end if f.WriteLine "
" & app.ConvertString( alb.ExpandMacro( pic, sCommentDS ), 0 ) f.WriteLine "
" k = k + 1 end if next if not bAutoRepeat then ' Auto-repeat not selected; display a "Finished" text and a button to restart the slideshow f.WriteLine "

" f.WriteLine "
Finished !

" f.WriteLine "
 " f.WriteLine "

" end if f.WriteLine "
" f.WriteLine "" f.WriteLine "" f.WriteLine "Built with MyAlbum" f.WriteLine "
" if bUseSelectionList then ' As we have the complete list at the end, use DHTML to add a drop-down list containing the items f.WriteLine "" end if f.WriteLine "" f.WriteLine "" f.WriteLine "

This demo requires Microsoft Internet Explorer 5.5 or later.
" f.WriteLine "" f.WriteLine "" f.Close 'app.Run outputFileName, True, -1 app.Trace "HTML file generation complete !", -1, TRACE_GREENDOT function ceil(val) ceil = fix(val) if ceil <> val then ceil = ceil + 1 end function