'------------------------------------------------------------------------ ' SearchInAlbums.vbs ' This VBScript searches for a string in the albums ' in the current album. ' ' The current album should contain other albums, each of these albums ' is opened and the specified string is searched in the comments of ' the pictures the album contains. The comparison is case sensitive. '------------------------------------------------------------------------ Option Explicit app.ClearTrace ' Define the variables dim alb, nb, i, pic, albN, searchString set alb = app.GetCurrentAlbum searchString = InputBox( "Enter the text to find", "SearchInAlbums", "") nb = alb.nbPicture for i=0 to nb-1 Set pic = alb.GetPicture(i) if (pic.lStatus and 255) = 30 then ' the picture is an album 'app.Trace "Processing Album '" & pic.sShortFileName set albN = app.LoadAlbum( pic.sFileName ) DoSearch albN, searchString end if next app.Trace "Done !" Function DoSearch( alb, searchString ) dim nb, i, pic, bFirst bFirst = True nb = alb.nbPicture for i=0 to nb-1 Set pic = alb.GetPicture(i) if InStr( pic.sComment, searchString ) then if bFirst then app.Trace "Found in album '" & alb.FullName & "' :" bFirst = False end if app.Trace " " & pic.sFileName end if next End Function