CHDK Forum
Using CHDK => Script Writing => Topic started by: ryazii3000 on 07 / November / 2013, 16:31:23
-
I think this is a scripting issue, but I'm not 100% sure.
I have a Canon Powershot A2400 with CHDK loaded on it. Everything appears normal there. What I want to do is to have my camera zoom to a specific spot every time I turn on the camera. Is that done through scripts? If so, can you give me a rundown of the steps I need to go through to get this done?
Thank you much!
-
You can configure a CHDK script to run each time the camera starts. The option to do that is in the CHDK scripting menu.
What you then need is a small script that pauses for a couple of seconds to let the camera get all setup, and then issues a set_zoom() (http://chdk.wikia.com/wiki/CHDK_scripting#set_zoom_.2F_set_zoom_rel_.2F_get_zoom_.2F_set_zoom_speed) command.
You can make the zoom position a fixed value in the script, or use the @parameter script construct to allow you to specific the zoom position that will be used at subsequent startups.
Let me know if you need help writing the script.
-
Found this in my collection - should do the job.
-
I just loaded up the script you attached and it's perfect! Works beautifully. Thank you both so much! :)
-
Cut & pasted the code here - sometime forum attachments get lost during upgrades & server migration.
--[[
@title Zoom Preset
@param z Zoom (%)
@default z 0
@range z 0 100
--]]
set_console_layout(1 ,1, 45, 14 )
sleep(2000)
if ( get_mode() == false ) then set_record(1)
while ( get_mode() == false ) do sleep(100) end
end
zstep=((get_zoom_steps()-1)*z)/100
print("Setting zoom to "..z.." percent. Step="..zstep)
sleep(500)
set_zoom(z)
sleep(1000)
exit_alt()