' ------------------------------------------------------------------------------------ ' SlideshowTimer.vbs ' This script allows you to easily time your slideshow by assigning to each picture ' a different display time. ' ' Assign this script to a keyboard shortcut (say Ctrl+U). ' Select the first picture and press Ctrl+U, the slideshow will start, ' to move to the next picture, press again Ctrl+U, the time the picture has been ' displayed will then be recorded. ' ------------------------------------------------------------------------------------ Option Explicit ' You must wait for 30s between each use ! ' also the maximal time is 30s const MAXTIME = 30000 const STATE_ALBUM=1 const NOSHOW=False 'const NOSHOW=True dim alb, j, n, d, pic app.ClearTrace set alb = app.GetCurrentAlbum ' MsgBox ">>> " & app.sInfo & " - " & j if not NOSHOW then if app.nState = STATE_ALBUM then alb.DisplayPicture(0) app.sInfo = "" end if end if d = getElapsedTime app.Trace "Delay = " & d if d <> -1 then j = alb.nCurrentPicture Set pic = alb.GetPicture(j) pic.lTransition = (pic.lTransition and &hffff0000) or (d / 100) alb.Saved = False j = j+1 if j < alb.nbVisiblePicture then ' Move to the next picture alb.nCurrentPicture = j if not NOSHOW then alb.DisplayPicture(0) else 'alb.Redraw end if else if not NOSHOW then alb.CloseDisplay end if end if ' Compute the delay function getElapsedTime() dim n, s, d1, d2 getElapsedTime = -1 ' Use sInfo to retrieve the last time the script was run if app.sInfo <> "" then d1 = app.sInfo else d1 = 0 end if d2 = app.GetTickCount ' Store current time in sInfo app.sInfo = d2 'msgbox app.sInfo & " = " & d2 if d2-d1 < MAXTIME then getElapsedTime = d2 - d1 end function