' ------------------------------------------------------------------------------------ ' SplitBeamSplitterPair.vbs ' This script will split a stereo pair picture in a Left and a Right picture. ' The pair is a photo taken with my beam-splitter that left a wide black band in the ' middle of the picture. ' Parallel viewing is assumed when naming the left and right pictures. ' ------------------------------------------------------------------------------------ Option Explicit ' Define the keyword that will be assigned to the splitted pictures ' (define as "" if no keyword assignment is needed) const sKeyWord = "Paires" ' Define the dimensions of the two rectangles for the left and right picture const rcL_l = 135 const rcL_t = 20 const rcR_l = 1016 const rcR_t = 20 const rc_w = 620 const rc_h = 1170 dim alb, pic, newPic, i, nb, kP, k, sFileName, sNewFile app.ClearTrace set alb = app.GetCurrentAlbum if not alb is nothing and alb.nbSelectedPicture > 0 then ' Retrives the selected pairs in the album nb = alb.nbPicture set pic = alb.GetPicture( 0 ) while not pic is Nothing if pic.bSelected and pic.w = 1792 and pic.h = 1200 then app.trace "Spliting picture " & pic.sShortFileName & "..." k = pic.num ' Process left part sFileName = alb.ExpandMacro( pic, "%RP" ) k = InStrRev( sFileName, "." ) sFileName = Left( sFileName, k-1 ) pic.CopyRect rcL_l, rcL_t, rc_w+rcL_l, rc_h+rcL_t, 0 sNewFile = sFileName & "_L.jpg" app.Trace " Saving left picture as '" & sNewFile & "'..." alb.Paste sNewFile ' The new picture is at the end of the album, move it next to the original picture set newPic = alb.GetPicture( alb.nbPicture-1 ) alb.MovePicture newPic, alb.CvtNumPic( pic.num, False ), True if sKeyWord <> "" then newPic.SetKeyword sKeyWord, True ' and the right part pic.CopyRect rcR_l, rcR_t, rc_w+rcR_l, rc_h+rcR_t, 0 sNewFile = sFileName & "_R.jpg" app.Trace " Saving right picture as '" & sNewFile & "'..." alb.Paste sNewFile set newPic = alb.GetPicture( alb.nbPicture-1 ) alb.MovePicture newPic, alb.CvtNumPic( pic.num, False )+1, True if sKeyWord <> "" then newPic.SetKeyword sKeyWord, True set newPic = Nothing ' Album has now two more pictures nb = nb+2 end if set pic = pic.next wend alb.redraw else MsgBox "No picture selected!" end if app.Trace "Done!!!"