rem based on 'Interval' by Johan Van Barelrem Massively Modified by A_Str8@title FlexInterval@param a Number of Pics@default a 10@param b Interval (Min)@default b 0@param c - (Sec)@default c 20@param d Initial Delay (Sec)@default d 1@param e Mode(0=#,1=infinite,2=time)@default e 0@param f Lock Focus (0=no, 1=yes)@default f 0@param g Original (Hours)@default g 4@param h - (Min)@default h 0@param i Target (Min)@default i 0@param j - (Sec)@default j 30@param k FPS@default k 24@param l Log (0=no, 1=yes)@default l 0if e=2 then gosub "math"if a<2 then let a=2if b<0 then let b=0if c<0 then let c=0if d<0 then let d=0if f<>1 then f=0t=b*60000+c*1000d=d*1000s=2if l=1 then print_screen 10T=get_day_secondsT=T/60H=T/60print T/60":"T%60, " - New interval set"if e<>1 then print " Pics:"; aif e<>1 then print " Tot. Time:", t*(a-1)/60000; " Min", t*(a-1)%60000/1000; " Sec"if e=1 then print " Unlimited pics . . ."print " Interval: "b " Min "c " Sec"print "------------"if l=1 then print_screen 0if f=1 then gosub "lock_focus"if d>Z then M=d-Z else M=0sleep Mif e<>1 then print "Pic 1 of", aif e=1 then print "Pic 1"if f=1 then gosub "quick_shoot" else gosub "focus_shoot"if e=1 then goto "endless" else gosub "norm_loop"print "Exiting . . ."sleep 1000endrem Focus. Record elapsed time in 'Z':focus X=get_tick_count press "shoot_half" do get_prop 206 P until P=1 Y=get_tick_count Z=Y-Xreturnrem Lock focus. Record elapsed time in 'Z':lock_focus gosub "focus" click "down" sleep 250 click "erase" sleep 250 release "shoot_half" Y=get_tick_count Z=Y-Xreturn rem Focus, then shoot. Record time elapsed in "Z":focus_shoot gosub "focus" W=Z gosub "quick_shoot" Z=W+Zreturnrem Shoot without focusing. Record time elapsed in "Z":quick_shoot X=get_tick_count click "shoot_full" do get_prop 206 P until P<>1 Y=get_tick_count Z=Y-Xreturnrem Take preset number of shots:norm_loop for s=2 to a print "Wait",b;"Min",c;"Sec" if t>Z then M=t-Z else M=0 sleep M print "Pic", s, "of", a if f=1 then gosub "quick_shoot" else gosub "focus_shoot" next sreturnrem Take unlimited number of shots:endless print "Wait",b;"Min",c;"Sec" if t>Z then M=t-Z else M=0 sleep M print "Pic", s if f=1 then gosub "quick_shoot" else gosub "focus_shoot" s=s+1goto "endless"rem Calculate correct interval and number of shots based on desired framerate, original time, and target time.rem Please note this calculation is not accurate because intervals are always rounded down to the nearest second.:math A=g*3600+h*60 D=i*60+j B=D*k C=A/B if C<1 then C=1 b=C/60 c=C%60 a=k*D if a*C>=A then return a=A/Creturn
:math print_screen 11 print "A=g*3600+h*60" A=g*3600+h*60 print "A=", A print "D=i*60+j" D=i*60+j print "D=", D print "B=D*k" B=D*k print "B=", B print "C=A/B" C=A/B if C<1 then C=1 print "C=", C print "b=C/60" b=C/60 print "b=", b print "c=C%60" c=C%60 print "c=", c print "a=k*D" a=k*D print "a=", a if a*C>=A then return a=A/C print "a=", areturn
Started by robotman General Chat
Started by bastian74 « 1 2 » Script Writing
Started by runou General Discussion and Assistance
Started by CanonBlue Creative Uses of CHDK
Started by txcat « 1 2 » General Discussion and Assistance