...The program will not terminate at the end time like it should, but will start when expected.

rem Author SkyWalker9@title Selective Intervalometer@param a Number of Shots@default a 180@param e Interval (mins)@default e 5@param f Interval (secs)@default f 0@param p Starting Hour (24 Hr time)@default p 7@param q Starting Minute @default q 0@param r Ending Hour (24 Hr time)@default r 18@param s Ending Minute@default s 0@param u Start DOW (0=Sun..6=Sat)@default u 1@param v End DOW (0=Sun..6=Sat)@default v 6rem Check input variables for proper values if a<2 then a=2 if e<0 then e=0 if f<0 then f=0 if p<0 then p=0 if p>23 then p=23 if q<0 then q=0 if q>59 then q=59 if r<0 then r=0 if r>23 then r=23 if s<0 then s=0 if s>59 then s=59 if u<0 then u=0 if u>6 then u=6 if v<0 then v=0 if v>6 then v=6rem Calculate user specified cycle/interval time in ms d=(e*600+f*10)*100 if d<1 then d=1rem Next two statements combine "hour" and "minutes" (hour:11 minute:30 = 1130)rem This reduces the number of "if" statements required in "check_time" subroutine P=p*100+q R=r*100+srem Print Error message if Start Time is after End Time and exit script if r>=p then goto "ok1" print "START Time after END" end:ok1rem Print message if Start Day of Week is after End Day of Week and exit script if v>=u then goto "ok2" print "START DOW after END" end:ok2rem Calculate length of time period (1 min=60K "ticks") N=((r*60+s)-(p*60+q))*60000rem Print a caution message if Image Sabilization (IS) is enabled x=get_IS_mode if x<>3 then print "Caution: IS enabled" select u case 0; print "Start on Sun" case 1; print "Start on Mon" case 2; print "Start on Tue" case 3; print "Start on Wed" case 4; print "Start on Thur" case 5; print "Start on Fri" case 6; print "Start on Sat" end_select select v case 0; print "End on Sun" case 1; print "End on Mon" case 2; print "End on Tue" case 3; print "End on Wed" case 4; print "End on Thur" case 5; print "End on Fri" case 6; print "End on Sat" end_select print a" Shots/Hrs "p":"q"-"r":"s print "Every "e" min "f" sec"rem Allows camera vibrations to stop sleep 1000rem Initializes shot counter; script terminaterem when n=a in the "take_shots" subroutine n=1rem -- Do not add comments after this point ---:check_day gosub "dayofweek" if w>=u and w<=v then goto "check_time" goto "check_day":check_time F=get_time 0 Q=get_time 1 F=F*100+Q if F>=P and F<R then goto "take_shots" goto "check_day":take_shots i=get_tick_count i=i+N:more b=get_tick_count shoot sleep 100 print "Shot", n, "of", a if n=a then shut_down n=n+1 s=b+d:wait_loop b=get_tick_count if b<s then goto "wait_loop" if b<i then goto "more" goto "check_day":dayofweek D=get_time 3 M=get_time 4 Y=get_time 5 A = (14-M)/12 Y = Y-A M = M+12*A-2 w = (D+Y+(Y/4)-(Y/100)+(Y/400)+(31*M/12))%7 returnend

...I'm going to set the camera back up for tomorrow and see if it shoots between the expected times from 7am to 7pm with a 4 minute interval.

rem Author SkyWalker9@title Selective Intervalometer@param a Number of Shots@default a 180@param e Interval (mins)@default e 5@param f Interval (secs)@default f 0@param p Starting Hour (24 Hr time)@default p 7@param q Starting Minute @default q 0@param r Ending Hour (24 Hr time)@default r 18@param s Ending Minute@default s 0@param u Start DOW (0=Sun..6=Sat)@default u 1@param v End DOW (0=Sun..6=Sat)@default v 6rem Check input variables for proper values if a<2 then a=2 if e<0 then e=0 if f<0 then f=0 if p<0 then p=0 if p>23 then p=23 if q<0 then q=0 if q>59 then q=59 if r<0 then r=0 if r>23 then r=23 if s<0 then s=0 if s>59 then s=59 if u<0 then u=0 if u>6 then u=6 if v<0 then v=0 if v>6 then v=6rem Calculate user specified cycle/interval time in ms d=(e*600+f*10)*100 if d<1 then d=1rem Next two statements combine "hour" and "minutes" (hour:11 minute:30 = 1130)rem This reduces the number of "if" statements required in "check_time" subroutine P=p*100+q R=r*100+srem Print Error message if Start Time is after End Time print msg & exit if r>=p then goto "ok1" print "START Time after END" end:ok1rem Print message if Start Day of Week is after End Day of Week print msg & exit if v>=u then goto "ok2" print "START DOW after END" end:ok2rem Print a caution message if Image Sabilization (IS) is enabled x=get_IS_mode if x<>3 then print "Caution: IS enabled"rem Allows camera vibrations to settle sleep 1000rem Calculate length of total time period (1 min=60K "ticks") N=((r*60+s)-(p*60+q))*60000rem Calculate length of time period (1 min=60K "ticks") ifrem user starts during the active time period O=N gosub "dayofweek" if w<u or w>v then goto "ok3" F=get_time 2 Q=get_time 1 x=F*100+Q if x>=P and x<R then O=((r*60+s)-(F*60+Q))*60000:ok3rem Initializes shot counter; script terminaterem when n=a in the "take_shots" subroutine n=1rem -- Do not add comments after this point ---:info if n>1 then cls print a" Shots / DOW "u"-"v print "Hours "p":"q"-"r":"s print "Every "e" min "f" sec" print "Waiting for shot: "n:check_day gosub "dayofweek" if w>=u and w<=v then goto "check_time" goto "check_day":check_time F=get_time 2 Q=get_time 1 F=F*100+Q if F>=P and F<R then goto "take_shots" goto "check_day":take_shots i=get_tick_count i=i+O:more b=get_tick_count shoot sleep 100 print "Shot", n, "of", a if n=a then shut_down n=n+1 S=b+d:wait_loop b=get_tick_count if b<S then goto "wait_loop" if b<i then goto "more" O=N goto "info":dayofweek D=get_time 3 M=get_time 4 Y=get_time 5 A = (14-M)/12 Y = Y-A M = M+12*A-2 w = (D+Y+(Y/4)-(Y/100)+(Y/400)+(31*M/12))%7 returnend

rem Author SkyWalker9@title Selective Intervalometer@param a Number of Shots@default a 180@param e Interval (mins)@default e 5@param f Interval (secs)@default f 0@param p Starting Hour (24 Hr time)@default p 7@param q Starting Minute @default q 0@param r Ending Hour (24 Hr time)@default r 18@param s Ending Minute@default s 0@param u Start DOW (0=Sun..6=Sat)@default u 1@param v End DOW (0=Sun..6=Sat)@default v 6rem Check input variables for proper values if a<2 then a=2 if e<0 then e=0 if f<0 then f=0 if p<0 then p=0 if p>23 then p=23 if q<0 then q=0 if q>59 then q=59 if r<0 then r=0 if r>23 then r=23 if s<0 then s=0 if s>59 then s=59 if u<0 then u=0 if u>6 then u=6 if v<0 then v=0 if v>6 then v=6rem Calculate user specified cycle/interval time in ms d=(e*600+f*10)*100 if d<1 then d=1rem Next two statements combine "hour" and "minutes" (hour:11 minute:30 = 1130)rem This reduces the number of "if" statements required in "check_time" subroutine P=p*100+q R=r*100+srem Print Error message if Start Time is after End Time print msg & exit if r>=p then goto "ok1" print "START Time after END" end:ok1rem Print message if Start Day of Week is after End Day of Week print msg & exit if v>=u then goto "ok2" print "START DOW after END" end:ok2rem Print a Caution message if Image Stabilization (IS) is enabled x=get_IS_mode if x<>3 then print "Caution: IS enabled"rem Displays the disk space/free disk space in MB & percent x=get_disk_size x=x/1000 y=get_free_disk_space y=y/1000 z=(y*100)/x print "Free Space "y"MB ("z"%)"rem Built in delay of 1000 ms to allow camera vibrations to stop plus 1000 msrem to temporaily display the Caution msg if needed. sleep 2000rem Calculate length of total time period (1 min=60K "ticks"). This is done torem allow use of "tick_count" instead of "sleep" statements. This results in morerem consistent/dependable/accurate interval cycles. N=((r*60+s)-(p*60+q))*60000rem This calculation corrects the length of time period above if the user startsrem the script during the DOWs & Start/End range they have selected O=N gosub "dayofweek" if w<u or w>v then goto "ok3" F=get_time 2 Q=get_time 1 x=F*100+Q if x>=P and x<R then O=((r*60+s)-(F*60+Q))*60000:ok3rem Initializes shot counter; script shutdown camera when n=a in the "take_shots" section n=1rem -- Do not add comments after this point ---:info if n>1 then cls print a" Shots / DOW "u"-"v print "Hours "p":"q"-"r":"s print "Every "e" min "f" sec" print "Waiting for shot: "n:check_day gosub "dayofweek" if w>=u and w<=v then goto "check_time" goto "check_day":check_time F=get_time 2 Q=get_time 1 F=F*100+Q if F>=P and F<R then goto "take_shots" goto "check_day":take_shots i=get_tick_count i=i+O:more b=get_tick_count shoot sleep 100 print "Shot", n, "of", a if n=a then shut_down n=n+1 S=b+d:wait_loop b=get_tick_count if b<S then goto "wait_loop" if b<i then goto "more" O=N goto "info":dayofweek D=get_time 3 M=get_time 4 Y=get_time 5 A = (14-M)/12 Y = Y-A M = M+12*A-2 w = (D+Y+(Y/4)-(Y/100)+(Y/400)+(31*M/12))%7 returnend

Started by Jim Script Writing

Started by Co2Castro General Help and Assistance on using CHDK stable releases

Started by abhay Feature Requests

Started by Glenstr General Help and Assistance on using CHDK stable releases

Started by Davo « 1 2 » Script Writing