Hi,

I've just discovered CHDK yesterday in the early morning (01:00 am). It's amazing. So I tried scripts I found on the wiki pages. I'm interested in bracketing scripts for HDR. But unfortunately they didn't work on my old Ixus 800 IS (SD 700) for various reasons and mainly because different menu layout means different click sequences. I also think "sleep" commands make things very long and not very nice. And EV correction was also a missing feature for me. So I started modifying them and finally wrote the following script.

This script does not depend on menus so it should work for a large variety of cameras (even if I can only test it on my Ixus 800 IS). It's written for Allbest build #50 but I think I haven't use special functions so it may work with others. Please test it and comment. I tried to make it as quick as I could so there are neither "sleep" nor "rem" commands.

This is written for a Digic II processors, so for Digic III you have to change "get_prop 205 p" into "get_prop 206 p" (it appears twice).

There are 3 parameters :

- a : number of image over/under exposed so 2*a+1 images are shot
- b : step size in 1/3 EV
- c : EV correction en 1/3 EV

When you run the script a menu appears and you can modify the parameters' values (unfortunately they are not saved when the script ends, maybe some one knows how I could save them) with "up", "down" (to select a parameter) and "left", "right" (to change the value of the selected parameter). Then press "set" to take pictures or "disp" to exit the script. By the way, you have to make focus before running the script by half pressing the shoot button.

More comments on the script below.

`@title Bracketing`

@param a (Number images-1)/2 1..12

@default a 3

@param b Step size (1/3 EV) 1..12

@default b 2

@param c Correction (1/3 EV) -12..12

@default c 0

get_prop 25 w

get_prop 26 x

let y=1

do

let z=0

do

if a<1 then let a=1

if a>12 then let a=12

if b<1 then let b=1

if b>12 then let b=12

if c<-12 then let c=-12

if c>12 then let c=12

if y<1 then y=3

if y>3 then y=1

print ""

if y=1 then print "Num : <",2*a+1,">" else print "Num : ",2*a+1

if y=2 then print "Step: <",b/3,b%3,"/3 >" else print "Step: ",b/3,b%3,"/3"

if y=3 then print "Corr: <",c/3,c%3,"/3 >" else print "Corr: ",c/3,c%3,"/3"

print "[Set]=shoot [Disp]=exit"

wait_click

if is_key "up" then let y=y-1

if is_key "down" then let y=y+1

if y=1 and is_key "left" then let a=a-1

if y=2 and is_key "left" then let b=b-1

if y=3 and is_key "left" then let c=c-1

if y=1 and is_key "right" then let a=a+1

if y=2 and is_key "right" then let b=b+1

if y=3 and is_key "right" then let c=c+1

if is_key "set" then z=1

if is_key "display" then z=2

until z>0

if z=2 then goto "exit1"

let d=c*32-a*b*32

for s=1 to 2*a+1

set_prop 25 d

set_prop 26 d

print "Shoot at",d/96,(d/32)%3,"/3"

do

get_prop 205 p

until p=0

press "shoot_full"

do

get_prop 205 p

until p=1

release "shoot_full"

let d=d+b*32

next s

:exit1

until z=2

set_prop 25 w

set_prop 26 x

end

There is no "rem" to speed up the scripts so here are the comments:

Script title and parameters for CHDK script menu :

`@title Bracketing`

@param a (Number images-1)/2 1..12

@default a 3

@param b Step size (1/3 EV) 1..12

@default b 2

@param c Correction (1/3 EV) -12..12

@default c 0

Save initial EV correction:

`get_prop 25 w`

get_prop 26 x

Menu line counter:

`let y=1`

Main loop:

`do`

Menu exit code

- 0: stay in menu
- 1: shoot and come back to menu
- 2: don't shoot and exit

` let z=0`

Menu loop:

` do`

Check parameters values (maybe we could be more flexible as I managed to take a -5 1/3 EV picture):

` if a<1 then let a=1`

if a>12 then let a=12

if b<1 then let b=1

if b>12 then let b=12

if c<-12 then let c=-12

if c>12 then let c=12

Check menu line:

` if y<1 then y=3`

if y>3 then y=1

Print menu. First line is blank so the last line from previous menu is not shown. Maybe something better could be done for EV printing (-1 -1 /3 is not very nice). Does some one knows if we could remove the extra space character between print arguments?

` print ""`

if y=1 then print "Num : <",2*a+1,">" else print "Num : ",2*a+1

if y=2 then print "Step: <",b/3,b%3,"/3 >" else print "Step: ",b/3,b%3,"/3"

if y=3 then print "Corr: <",c/3,c%3,"/3 >" else print "Corr: ",c/3,c%3,"/3"

print "[Set]=shoot [Disp]=exit"

Wait for key press and process it:

` wait_click`

if is_key "up" then let y=y-1

if is_key "down" then let y=y+1

if y=1 and is_key "left" then let a=a-1

if y=2 and is_key "left" then let b=b-1

if y=3 and is_key "left" then let c=c-1

if y=1 and is_key "right" then let a=a+1

if y=2 and is_key "right" then let b=b+1

if y=3 and is_key "right" then let c=c+1

if is_key "set" then z=1

if is_key "display" then z=2

until z>0

if z=2 then goto "exit1"

Calculate initial underexposed EV correction:

` let d=c*32-a*b*32`

Shoot loop:

` for s=1 to 2*a+1`

Set EV correction. Using properties avoid having to depend on menu layout and clicks, and it's also really quicker.

` set_prop 25 d`

set_prop 26 d

print "Shoot at",d/96,(d/32)%3,"/3"

Wait for the camera to be ready for next shoot (change 205 to 206 for Digic III). Also putting this just before shoot should be the quickest solution as all calculations are terminated at this time.

` do`

get_prop 205 p

until p=0

Shoot. Use "shoot_full" so focus and exposure are not modified between shots. It's also quicker than a "shoot" command.

` press "shoot_full"`

Wait for camera to be really shooting (change 205 to 206 for Digic III):

` do`

get_prop 205 p

until p=1

Prepare for next shoot:

` release "shoot_full"`

let d=d+b*32

next s

End of main loop, exit if "disp" was selected in the menu:

` :exit1`

until z=2

Restore initial EV correction values and exit:

`set_prop 25 w`

set_prop 26 x

end

Thanks for reading ! Comments welcome.

Nicolas bertolissio