' ------------------------------------------------------------------------------------ ' Rotate the selected pictures ' ' This script will rotate the selected pictures 90° clockwise. ' These pictures must be JPEG pictures. ' You must install the jpegtran program first. ' Please make a backup of your pictures first as they will be replaced. ' ------------------------------------------------------------------------------------ Option Explicit app.ClearTrace dim alb, i, n, nbPic, fso set alb = app.GetCurrentAlbum nbPic = alb.NbSelectedPicture app.trace nbPic & " pictures to rotate" Set fso = CreateObject("Scripting.FileSystemObject") n = alb.NbPicture dim pic, filename, tempfolder, newFile, a, sAppRotate, sCmd, bRetCode, lRunParam ' Change the two following lines if necessary sAppRotate = "M:\DigiCam\jpegtran32.exe -copy all -rotate 90 " ' Run parameter= bits 0-3: New window state (0:hidden,1:normal) ' bit 16: Run synchronously with MyAlbum lRunParam = &h10001 ' Get a temporary file Const TemporaryFolder = 2 Set tempfolder = fso.GetSpecialFolder( TemporaryFolder ) newFile = tempfolder.Path & "\" & fso.GetTempName const TYPE_JPEG=2 for i = 0 to n-1 Set pic = alb.GetPicture(i) if pic.bSelected then if (pic.lStatus and &HFF) = TYPE_JPEG then ' Get the relative path of the picture filename = alb.ExpandMacro( pic, "%RP" ) app.Trace " Processing #" & i+1 & " " & filename sCmd = sAppRotate & """" & filename & """ """ & newFile & """" app.trace scmd bRetCode = app.Run( sCmd, False, lRunParam ) if bRetCode=0 then Set a = fso.GetFile( filename ) ' Make backup of the picture a.Copy filename & ".bak" a.Delete Set a = fso.GetFile( newFile ) a.Move fileName pic.UpdateThumbnail True else app.Trace "Error!!!" end if else app.Trace "The picture '" & pic.sFileName & "' is not a JPEG file. Not processed." end if end if next alb.ReDraw app.trace "Done!!!"