Option Explicit ' User may need to change, see below. const SOURCE = 2 const DEST = 3 ' ------------------------------------------------- ' DeleteFlaggedFiles.vbs ' This script is used in conjunction with the BatchResize.vbs script. ' See BatchResize.vbs for a fuller description and an example usage. ' ' The Destination album is read and, for any flagged thumbnails found, ' both the files and thumbnais are deleted from both the Source and ' Destination folders and albums. ' ' WARNING!! The deleted files are gone, they are not in the recycle bin, ' thus, any slip is death. Nortons Virus Software and probably ' most other anti-virus software, give a virus alert when this script ' is run. This is because files are being deleted from within the ' script. The recommended action from Nortons is to stop the script. ' I choosethe Authorise this script option. ' ' The concept of the source and destination is the same as that in ' BatchResize.vbs. i.e. The Source Folder is the same as the source ' folder in BatchResize.vbs. The Destination folder is the same as ' that in BatchResize.vbs. It is where the thumbnails are flagged. ' ' SOURCE is the number of the album shown in the Window menu of MyAlbumPro. ' DEST is the number of the album containg the flagged files. ' --------------------------------------------------------- ' ' Main const SRC = 0 const DST = 1 Dim arrsAlbum(2) ' Album names Dim intPicsProcessed app.ClearTrace ' Maim program ' Get album names and query user to ensure they are correct. If IsCorrectAlbums = vbYes Then intPicsProcessed = ProcessAlb if intPicsProcessed > 0 Then app.Trace "Done! " & intPicsProcessed & " pictures processed." End If Else app.Trace "Quiting the script" End If ' End of Main ' Process both the Source and Destination albums. Function ProcessAlb Dim fso Dim objAlb Dim objPic Dim arrPicNames() Dim strPicName Dim intCount, intPos, i, nPic, intNoPics Dim boolFlagged ' Create a file system object for deleting the files. set fso = CreateObject("Scripting.FileSystemObject") set objAlb = app.GetAlbum(DEST - 1) intNoPics = objAlb.nbPicture ' Accumulate the names of the flagged pictures in the Destination album ReDim arrPicNames(intNoPics) intCount = 0 for i = 0 to intNoPics -1 set objPic = objAlb.GetPicture(i) boolFlagged = objPic.lStatus And STATE_FLAGGED If boolFlagged Then arrPicNames(intCount) = objPic.sShortFileName intCount = intCount + 1 End If Next ' Process the Destination album. app.Trace "Processing Destination Album: " & arrsAlbum(DST) set objAlb = app.GetAlbum(DEST - 1) for i = 0 to intCount - 1 set objPic = objAlb.GetPictureByFileName(arrPicNames(i) ) If IsObject(objPic) = True Then strPicName = objPic.sFileName objAlb.DeletePicture( objPic ) If fso.FileExists(strPicName) Then fso.DeleteFile strPicName End If End If Next objAlb.ReDraw() objAlb.ReDrawFullScreen() ' Process Source Album. app.Trace "Processing Source Album " & arrsAlbum(SRC) set objAlb = app.GetAlbum(SOURCE - 1) for i = 0 to intCount - 1 set objPic = objAlb.GetPictureByFileName(arrPicNames(i) ) If IsObject(objPic) = True Then strPicName = objPic.sFileName objAlb.DeletePicture(objPic ) If fso.FileExists(strPicName) Then fso.DeleteFile strPicName End If End If Next objAlb.ReDraw() objAlb.ReDrawFullScreen() ProcessAlb = intCount End Function ' Get the album names and check that the Source and Destination ' albums are correct. Function IsCorrectAlbums Dim strStr Dim objAlb set objAlb = app.GetAlbum(SOURCE - 1) arrsAlbum(SRC) = objAlb.FullName set objAlb = app.GetAlbum(DEST - 1) arrsAlbum(DST) = objAlb.FullName strStr = "Source File: " & arrsAlbum(SRC) & chr(13) strStr = strStr & "Destination File: " & arrsAlbum(DST) & chr(13) strStr = strStr & "Proceed?" IsCorrectAlbums = MsgBox (strStr, vbYesNo, "DeleteFlaggedFiles") End Function