set notification to display dialog "Start Canon EOS Utility and connect your camera. Make sure the camera control window is in front of the image preview window." buttons {"Ok"} default button 1


set question to display dialog "What type of Timelapse?" buttons {"Normal", "HDR", "Exposure Changing"} default button 1

set answer to button returned of question



#Normal Timelapse

if answer is equal to "Normal" then

set delayTime to 0

set shotsNumber to 0

--set the number of photographs to take

set displayString to "How many shots do you want to take?"

set response to display dialog displayString default answer 0

set shotsNumber to (text returned of response)

--set the delay between each photograph

set displayString to "How long do you want the delay between shots?"

set response to display dialog displayString default answer 0

set delayTime to (text returned of response) + 1

--take the timelapse

repeat shotsNumber times

activate application "EOS Utility"

tell application "System Events" to tell process "EOS Utility" to keystroke space

delay delayTime

end repeat

endMessage()

end if



#HDR Timelapse

if answer is equal to "HDR" then

set notification to display dialog "Make sure exposure bracketing is set on your camera." buttons {"Ok"} default button 1

set delayTime to 0

set shotsNumber to 0

--set the number of photographs to take

set displayString to "How many shots do you want to take?"

set response to display dialog displayString default answer 0

set shotsNumber to (text returned of response) + 1

--set the delay between each photograph

set displayString to "How long do you want the delay between shots?"

set response to display dialog displayString default answer 0

set delayTime to (text returned of response)

--take the timelapse

repeat shotsNumber times

activate application "EOS Utility"

tell application "System Events" to tell process "EOS Utility" to key down space

delay 2

activate application "EOS Utility"

tell application "System Events" to tell process "EOS Utility" to key up space

delay delayTime

end repeat

endMessage()

end if



#Exposure Changing Timelapse

if answer is equal to "Exposure Changing" then

set notification to display dialog "Set your camera to manual 'M' mode and set your shutter speed to BULB." buttons {"Ok"} default button 1

set delayTime to 0

set shotsNumber to 0

set startExposure to 0

set exposureChange to 0

--set the number of photographs to take

set displayString to "How many shots do you want to take?"

set response to display dialog displayString default answer 0

set shotsNumber to (text returned of response) + 1

--set the delay between each photograph

set displayString to "How long do you want the delay between shots?"

set response to display dialog displayString default answer 0

set delayTime to (text returned of response)

--set the initial exposure

set displayString to "What do you want the initial exposure to be?"

set response to display dialog displayString default answer 0

set startExposure to (text returned of response)

--set the change in exposure

set displayString to "How fast do you want the exposure to change?"

set response to display dialog displayString default answer 0

set exposureChange to (text returned of response)

--take the timelapse

repeat shotsNumber times

set startExposure to startExposure + exposureChange

shutterPress()

delay startExposure

shutterPress()

delay delayTime

end repeat

endMessage()

end if



#Displays the end message

on endMessage()

set notification to display dialog "The timelapse is finished." buttons {"Ok"} default button 1

end endMessage