Auto Zoom Script - Script Writing - CHDK Forum

Auto Zoom Script

  • 4 Replies
  • 2975 Views
Auto Zoom Script
« on: 07 / November / 2013, 16:31:23 »
Advertisements
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!

Re: Auto Zoom Script
« Reply #1 on: 07 / November / 2013, 17:32:32 »
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()  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.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Auto Zoom Script
« Reply #2 on: 07 / November / 2013, 20:40:31 »
Found this in my collection - should do the job.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Auto Zoom Script
« Reply #3 on: 17 / November / 2013, 12:54:00 »
I just loaded up the script you attached and it's perfect!  Works beautifully.  Thank you both so much! :)


Re: Auto Zoom Script
« Reply #4 on: 17 / November / 2013, 13:10:08 »
Cut & pasted the code here - sometime forum attachments get lost during upgrades & server migration.

Code: [Select]
--[[
@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()
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics