' ------------------------------------------------------------------------------------ ' AutoTOC ' This script builds a HTML table of content for the current album and place ' it at the beginning of the album. ' ------------------------------------------------------------------------------------ Option Explicit app.ClearTrace Dim alb, pic set alb = app.GetCurrentAlbum Dim outputFileName outputFileName = Replace( alb.FullName, ".alb", ".html" ) app.Trace "Output file = " & outputFileName Const ForReading = 1, ForWriting = 2 Dim fso, f, m Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile( outputFileName, ForWriting, True) f.WriteLine "" f.WriteLine "" f.WriteLine " " f.WriteLine " " f.WriteLine " " & alb.sAlbumTitle & " - " & alb.sAlbumComment & "" f.WriteLine "" f.WriteLine "" f.WriteLine "

" & alb.sAlbumTitle & "

" f.WriteLine "

" & alb.sAlbumComment & "

" ' Process each picture Dim nbPic, i, s nbPic = alb.nbPicture app.Trace "Pictures in this album: " & nbPic f.WriteLine "" for i=0 to nbPic-1 Set pic = alb.GetPicture(i) if pic.sFileName <> outputFileName then f.WriteLine "" f.WriteLine " " f.WriteLine " " f.WriteLine "" end if next f.WriteLine "
" & alb.ExpandMacro( pic, "%BF" ) & "" & pic.sCommentFirstLine & "
" f.WriteLine "
Build with MyAlbum script
" f.WriteLine "" f.WriteLine "" f.Close app.Trace nbPic & " picture processed" set pic = alb.addPicture( outputFileName ) alb.movePicture pic, 0, FALSE app.Trace "HTML file generation complete !"