;========================================================================
; The main idea of the script is to use the Canon given EOS Utility to
; take multiple exposure shots in an automated way. This will allow
; the script to be executed by the Papywizard shoot.py script.
;
; The real thing is done by sending the needed key strokes to EOS Utility
; so that the correct shutter speed is set and the shutter button is pressed.
;
; For the command line use, the first parameter should be CL.
;
; Software needed:
; AutoHotKey from http://www.autohotkey.com/
; Canon Camera Driver for your EOS Digital camera
; EOS Utility that comes with the camera
;
; How to use:
; 0. Install the AutoHotKey
; 1. Copy the content of this script to a file called
; EOSBracket.ahk
; 2. Place the file in the Papywizard directory
; (For example C:\Program Files\Papywizard)
; 3. Right click on the script and select the compile option
; This will create an stand alone executable EOSBracket.exe
; 4. Copy the exposure bracket information and place it in the
; Papywizard root directory named as bracket.ini
; 5. Change the shoot.py script to execute EOSBracket.exe
; 6. Run the Papywizard
; 7. Run the EOS Utility and go to the Camera window
; 8. Try it in simulation mode (with Shoot=n in bracket.ini)
; 9. Take the real thing!
;
; Commandline Use (no need for bracket.ini):
; 0. The first parameter should be CL
; 1. The parameters are of the same order as in bracket.ini
; For explanation of the parameter, see the bracket.ini file
; a. EOSUtilityType
; b. BracketValue
; c. BracketType
; d. BracketNumber
; e. Shoot
; f. BulbMode
; g. BulbBaseExposure
; h. FocusBracket
; i. FocusDirection
; j. FocusStep
; k. FocusStepCount
; l. FocusNumber
;
; Papywizard plugin use:
; The Papywizard plugin named "EOS Utility" will have three different tabs.
; The Main tab will allow the user to set the following values
; a. EOSUtilityType
; b. BracketValue
; c. BracketType
; d. BracketNumber
; e. Shoot
; The Bulb tab will allow the user to set the following values
; f. BulbMode
; g. BulbBaseExposure
; The Focus tab will allow the user to set the following values
; h. FocusBracket
; i. FocusDirection
; j. FocusStep
; k. FocusStepCount
; l. FocusNumber
;
; DISCLAIMER:
; This script is provided "AS IS". You are responsible for any
; demage using this script.
;
; Author: Jones Henry Subbiah
;
; 0.0 Initial version for exposure bracketing
; 0.1 Added support for the old EOS Utility
; 0.2 Added bulb exposure bracketing
; 0.3 Added command line interface to work wiht plugin architecture
; 0.4 Added focust bracketing
;=========================================================================
; The window class name for the new EOS Utility.
; This value will be overwritten below for the old EOS Utility
ClassName := "WindowsForms10.Window.8.app.0.3553390"
; Initialize all the global variables
; EOS Utility type
eosut := "NEW"
; Exposure bracket value in 1/3 stops
eval := 2.0
; Exposure bracket type
btype := 3
; Number of exposures
bnum := 3
; Simulation mode or real
shoot := "N"
; Bulb mode or not
bm := "N"
; Bulb base exposure
bbe := 1.0
; Focus bracket mode
fm := "N"
; Focus direction
fd := "FAR"
; Focus step
fs := "MEDIUM"
; Focus step count
fsc := 1
; Number of focus stack pictues
fn := 1
; Check to see if it is a command line mode
if ( %0% > 0 and %1% = CL )
{
;MsgBox, Command Line parameters
;MsgBox, 0: %0% 1: %1% 2: %2% 3: %3% 4: %4% 5: %5% 6:%6% 7:%7% 8:%8% 9:%9% 10:%10% 11:%11% 12:%12% 13:%13%
eosut = %2%
eval = %3%
eval += 0.0
btyeval = %4%
bnum = %5%
shoot = %6%
bm = %7%
bbe = %8%
bbe += 0.0
fm = %9%
fd = %10%
fs = %11%
fsc = %12%
fn = %13%
;MsgBox, eosut:%eosut% eval:%eval% btye:%btype% bnum:%bnum% shoot:%shoot% bm:%bm% bbe:%bbe% fm:%fm% fd:%fd% fs:%fs% fsc:%fsc% fn:%fn%
}
; Get the parameters from the .ini file
else
{
;MsgBox, INI file parameters
; Read the EOSUtilityType parameter
; EOS Utility type. Default is NEW.
IniRead, eosut, bracket.ini, BracketSetting, EOSUtilityType, NEW
; Read the bracket value from bracket.ini file
; It is of the form (num) (num)/(num)
; The default value is 2 stops
IniRead, bval, bracket.ini, BracketSetting, BracketValue, 2
; Assume the whole number is 0.0
wnum := 0.0
; Split the input by space
StringSplit, we, bval, %A_Space%
; Found the space, then parse the number and fraction seperately
if ( we0 = 2 )
{
; Take care of the number
wnum := we1 + 0.0
; Parse the fraction
StringSplit, va, we2, /
num := va1 + 0.0
den := va2 + 0.0
eval := num / den
}
else
{
; Got only the fraction part. Parse the fraction
StringSplit, va, bval, /
if ( va0 = 2 )
{
num := va1 + 0.0
den := va2 + 0.0
eval := num / den
}
else
{
; Got only the number. Parse the number
wnum := bval + 0.0
}
}
eval += wnum
; Read the bracket type from bracket.ini file
; The default type is the Camera AEB -,0,+ mode
IniRead, btype, bracket.ini, BracketSetting, BracketType, 3
; Read the bracket number from bracket.ini file
; The number of exposures. Default is 3.
IniRead, bnum, bracket.ini, BracketSetting, BracketNumber, 3
; Read the shoot parameter for simulation or real shooting
; For simulation mode. Default is N
IniRead, shoot, bracket.ini, BracketSetting, Shoot, N
; Read the BulbMode parameter
; Bulb Mode. Default is N
IniRead, bm, bracket.ini, BracketSetting, BulbMode, N
; Read the BulbBaseExposure parameter
; Bulb base exposure. Default is 1 second.
IniRead, bbe, bracket.ini, BracketSetting, BulbBaseExposure, 1.0
bbe += 0.0
; Read the FocusBracket parameter
; Focus bracket enabled or not. Default is N.
IniRead, fb, bracket.ini, BracketSetting, FocusBracket, N
; Read the FocusDirection parameter
; Focus direction near or far. Default is FAR.
IniRead, fd, bracket.ini, BracketSetting, FocusDirection, FAR
; Read the FocusSteps parameter
; Focus steps - small(< or >), medium (<< or >>), large(<<< or >>>). Default is MEDIUM.
IniRead, fs, bracket.ini, BracketSetting, FocusSteps, MEDIUM
; Read the FocusStepCount parameter
; Number of focus steps. Default is 1.
IniRead, fsc, bracket.ini, BracketSetting, FocusStepCount, 1
fsc += 0
; Read the FocusNumber parameter
; Number of images for focus bracketing. Default is 1.
IniRead, fn, bracket.ini, BracketSetting, FocusNumber, 1
fn += 0
;MsgBox, eosut:%eosut% eval:%eval% btye:%btype% bnum:%bnum% shoot:%shoot% bm:%bm% bbe:%bbe% fm:%fm% fd:%fd% fs:%fs% fsc:%fsc% fn:%fn%
} ; End of getting parameters
; Make upper case
StringUpper, shoot, shoot
StringUpper, bm, bm
StringUpper, eosut, eosut
StringUpper, fb, fb
StringUpper, fd, fd
StringUpper, fs, fs
;MsgBox, eosut:%eosut% eval:%eval% btye:%btype% bnum:%bnum% shoot:%shoot% bm:%bm% bbe:%bbe% fm:%fm% fd:%fd% fs:%fs% fsc:%fsc% fn:%fn%
; If the old EOS Utility is used, set the window class correctly
; and make sure the bulb mode is truned off
IfEqual, eosut, OLD
{
ClassName := "#32770"
bm := "N"
fm := "N"
}
; Find out the # of left/right arrow key press for each bracket
acount := 0
iexp := 1.0 / 3.0
while ( 1 )
{
if ( eval < iexp )
break
if ( eval >= iexp )
acount += 1
iexp += 1.0 / 3.0
}
GoTo, start
; This function press the shutter button. It handles
; the bulb mode as well.
press_shutter()
{
; Global values needed
global shoot, bm, bbe
; If it Bulb mode, send the first shutter (space bar)
; to open the shutter
IfEqual, bm, Y
{
IfEqual, shoot, Y
{
Send {Space}
}
l_bbe := bbe + 1.0
l_bbe *= 1000
Sleep, %l_bbe%
}
; For the regular mode or to close the shutter
; of Bulb mode, send the shutter again
IfEqual, shoot, Y
{
Send {Space}
}
; Wait for a second
Sleep, 1000
}
; This function does all the over exposures.
do_overexposure(oecnt)
{
; Global values needed
global acount, bbe, bm
; Save the Bulb base exposure for now
old_bbe := bbe
; Shoot the over exposure
Loop, %oecnt%
{
; In the Bulb mode, calculate the shutter speed
IfEqual, bm, Y
{
bbe *= ( acount / 3.0 ) * 2.0
}
; In the regular mode, press Left key for the shutter speed
else
{
Send {Left %acount%}
Sleep, 1000
}
; Press the shutter
press_shutter()
}
; In the regular mode, set the exposure back to normal
IfNotEqual, bm, Y
{
; Go to normal exposure
ncnt := oecnt * acount
Send {Right %ncnt%}
}
; Save back the Bulb base exposure
bbe := old_bbe
}
; This function does all the under exposures.
do_underexposure(uecnt)
{
; Global values needed
global acount, bbe, bm
; Save the Bulb base exposure for now
old_bbe := bbe
; Shoot the under exposure
Loop, %uecnt%
{
; In the Bulb mode, calculate the shutter speed
IfEqual, bm, Y
{
bbe /= ( acount / 3.0 ) * 2.0
}
; In the regular mode, press Right key for the shutter speed
else
{
Send {Right %acount%}
Sleep, 1000
}
; Press the shutter button
press_shutter()
}
; In the regular mode, set the exposure back to normal
IfNotEqual, bm, Y
{
;MsgBox, uecnt: %uecnt% acount: %acount%
; Go to normal exposure
ncnt := uecnt * acount
Send {Left %ncnt%}
}
; Save back the Bulb base exposure
bbe := old_bbe
}
; This function does all the exposure bracketing
do_exposure_bracketing()
{
global btype, bnum
; Shoot the normal exposure
press_shutter()
; Regular +- bracketing
if ( btype = 3 )
ocnt := ( bnum - 1 ) / 2
; Over exposure + bracketing
if ( btype = 2 )
ocnt := bnum - 1
; Shoot the over exposure
do_overexposure( ocnt )
; Regular +- bracketing
if ( btype = 3 )
ucnt := ( bnum - 1 ) / 2
; Under exposure - bracketing
if ( btype = 2 )
ucnt := bnum - 1
; Shoot the under exposure
do_underexposure( ucnt )
}
; This fucntion opens the live window
goto_live_window()
{
Send +{Tab 5}
Send {Enter}
}
set_focus_change()
{
global fd, fs, fsc
Sleep, 3000
;MsgBox, fd: %fd% fs: %fs% fsc: %fsc%
tcnt := 0
; First find the # of tabs needed to go the correct focus button
IfEqual, fd, NEAR
{
;MsgBox, NEAR
IfEqual, fs, SMALL
tcnt := 6
IfEqual, fs, MEDIUM
tcnt := 5
IfEqual, fs, LARGE
tcnt := 4
}
IfEqual, fd, FAR
{
;MsgBox, FAR
IfEqual, fs, SMALL
tcnt := 7
IfEqual, fs, MEDIUM
tcnt := 8
IfEqual, fs, LARGE
tcnt := 9
}
;MsgBox, tcnt: %tcnt%
; Set the focus on the correct focus button
Send {Tab %tcnt%}
Sleep, 1000
;MsgBox, wait1...
; Change the focus
Loop, %fsc%
{
Send {Space}
Sleep, 100
;MsgBox, wait2...
}
Sleep, 1000
tcnt++
; Go to Close button and press enter
Send +{Tab %tcnt%}
Send {Enter}
Sleep, 1000
; If EOS Utility is running, select the screen
if (WinExist("ahk_class" . ClassName))
{
WinActivate
}
; Go to shutter speed box
Send {Tab 4}
}
start:
; If EOS Utility is running, select the screen
if (WinExist("ahk_class" . ClassName))
{
WinActivate
}
; If not, just give the error message and done with it
else
{
MsgBox No EOS Utility window exists.
return
}
; Wait for a millisecond
sleep 1
; Set the focus to the shutter button
; First find the Main Window... button and tab two times for the new EOS Utility
; Find the Setup button and tab one time for the old EOS Utility
searchString := "Main Window"
IfEqual, eosut, OLD
{
MouseMove, 220, 380
searchString := "Setup"
}
else
{
MouseMove, 200, 600
searchString := "Main Window"
}
MouseGetPos,,,id2,control2
ControlGetText,tval2,%control2%
ControlFocus, %control2%
; If we found the button, good
IfInString, tval2, %searchString%
{
goto shutter
}
else
{
MsgBox Unable to find the %searchString% button for EOS Utility
return
}
shutter:
; Go to Shutter box
Send {Tab}
IfNotEqual, eosut, OLD
{
Send {Tab}
}
; In bulb mode, make sure we are at bulb exposure
IfEqual, bm, Y
{
Send {Down}
}
do_exposure_bracketing()
IfEqual, fm, Y
{
;MsgBox, Focus Bracketing... fn: %fn%
fn--
;MsgBox, fn: %fn%
; Loop for each focus bracket
Loop, %fn%
{
;MsgBox, inside loop...
goto_live_window()
set_focus_change()
do_exposure_bracketing()
}
}
; Wait for a second
Sleep, 1000
; Done with the script
return
;============================================================
; This bracket.ini file should be placed in the same
; directory where Papywizard is intalled. For example,
; C:\Porgram Files\Papwizard.
;
; Author: Jones Henry Subbiah
;
;============================================================
[BracketSetting]
;============================================================
; EOSUtilityType This parameter is to specify whether
; the EOS Utility is the old one used
; with Digital Rebel, 20D etc
; or the new one (black screen)
; old,OLD Cameras like 300D, 20D
; new,NEW Cameras like 450D
;
; NOTE: If the value is old, the BULB mode will be disabled since
; EOS Utility is not supporting that functionality
;============================================================
EOSUtilityType=new
;============================================================
; BracketValue This parameter is to specify the exposure
; bracket value in 1/3 steps. For example,
; 1/3, 1 2/3 and 2 are possible values.
;============================================================
BracketValue=1
;============================================================
; BracketType This parameter is the type of bracketing.
; The possible values are
; 1 Over Exposure Bracketing
; In this mode, the shutter speed
; will be reduced by the amount of
; BracketValue. For example, if the
; BracketValue is 1 and the initial
; shutter is 1/500, then the next
; shot will be at 1/250, 1/60 etc
;
; 2 Under Exposure Bracketing
; In this mode, the shutter speed
; will be increased by the amount of
; BracketValue. For example, if the
; BracketValue is 1 and the initial
; shutter is 1/500, then the next
; shot will be at 1/1000, 1/ etc
;
; 3 Regular Bracketing
; This works just like the in-camera
; exposure bracketing - like a normal,
; over and under exposure
;============================================================
BracketType=3
;============================================================
; BracketNumber This parameter is to specify the number of
; bracketed shots to be taken
;============================================================
BracketNumber=3
;============================================================
; Shoot This parameter is to try out the sequence of
; exposure before taking the shot.
; y,Y This will take the actual shot
; n,N This will not take the shot
;============================================================
Shoot=n
;============================================================
; BulbMode This parameter is to know if the exposures
; will be using the Bulb mode in the camera.
; In this case, the exposure time will be
; calculated for other exposures from the
; base exposure.
; y,Y This will enable the bulb mode if
; EOS Utility supports
; n,N This will disable the bulb mode
;
; NOTE: EOS Utility did not support the Bulb mode for 20D
; and for 300D it went to Bulb mode but disabled the shutter
; button.
;============================================================
BulbMode=n
;============================================================
; BulbBaseExposure This parameter is to specify the
; base bulb exposure time in seconds.
;============================================================
BulbBaseExposure=4
;============================================================
; FocusBracket This parameter is to specify whether
; the Focus Bracketing is done or not.
; This can be combined with the regular
; exposure bracketing.
; Default is N
; y,Y Focus Bracketing enabled
; n,N Focus Bracketing disabled
;============================================================
FocusBracket=n
;============================================================
; FocusDirection This parameter is used to change the
; focus towards camera (near) or away
; from the camear (far).
; Default is FAR
; near,NEAR Focus is changed towards
; the camera (<,<<,<<<)
; far,FAR Focus is changed away
; from the camera (>,>>,>>>)
;============================================================
FocusDirection=far
;============================================================
; FocusStep This parameter is used to specify
; the focus step or the increment in
; the focus change to be used.
; Default is MEDIUM
; small,SMALL < or > key
; medium,MEDIUM << or >> key
; large,LARGE <<< or >>> key
;============================================================
FocusStep=medium
;============================================================
; FocusStepCount This parameter is used to specify
; how many number of FocusStep (defined
; in the previous parameter) to be used
; for each focus interval
; Default is 1
;============================================================
FocusStepCount=1
;============================================================
; FocusNumber This parameter is used to specify
; the number of focus bracketing images
; for the focus bracketing.
; Default is 1
;============================================================
FocusNumber=3
Users browsing this forum: No registered users and 4 guests