'-------------------------------------------------------------------------- ' MoveFlaggedPicHere.vbs ' Move all the flagged pictures after the current picture. ' The flags are erased and the moved pictures are selected. '-------------------------------------------------------------------------- Option Explicit ' Define the constants and variables 'const STATE_FLAGGED=&h20000 'const DM_HIDEPIC=&h200000 dim alb, nb, i, pic, nbMoved, nRefPic app.ClearTrace nbMoved = 0 set alb = app.GetCurrentAlbum ' Display all the pictures (simpler when dealing with picture indexes) alb.nActiveTab = 0 alb.nDisplayMode = alb.nDisplayMode and not DM_HIDEPIC alb.Redraw nb = alb.nbPicture nRefPic = alb.nCurrentPicture 'This is the picture after which the flagged ones will be put set pic = alb.GetPicture(nRefPic) app.Trace "The reference picture is " & nRefPic & " (" & pic.sShortFileName & ")" ' Clear any flag on the reference picture just in case... pic.lStatus = pic.lStatus xor STATE_FLAGGED for i=0 to nb-1 Set pic = alb.GetPicture(i) if pic.lStatus and STATE_FLAGGED then app.Trace pic.sShortFileName ' Select it so we know which ones have been moves pic.bSelected = True ' Remove the flag so it wont be moved again pic.lStatus = pic.lStatus xor STATE_FLAGGED alb.MovePicture pic, nRefPic, True ' The moved picture becomes the new reference ' (but the index does not change if the if the moved picture was before the reference) if i > nRefPic then nRefPic = nRefPic+1 i = i-1 nbMoved = nbMoved + 1 end if next alb.ReDraw app.Trace nbMoved & " pictures moved" app.StatusBarText = nbMoved & " pictures moved"