A4000IS script for bookscanning using remote trigger - Script Writing - CHDK Forum

A4000IS script for bookscanning using remote trigger

  • 2 Replies
  • 4082 Views
A4000IS script for bookscanning using remote trigger
« on: 14 / July / 2013, 15:50:17 »
Advertisements
Okay - so I've spent some time trying to figure out and create a hybrid script from various posts to get my camera to focus lock, exposure lock, then take an identical photo every time I press the remote trigger. I'm now a bit frustrated, as between learning to write scripts, and implementing them, I've got confused and lost. I haven't even tried running it as its that horrible. Please help get it running.
Thanks,
Dave

REM Set AF, AE, and then take pic with remote button.
REM Default distance is 45mm from camera to glass. Don't think there's much point in using this if use AF.
REM Get_prop 206 tests when DIGIC III camera is ready to shoot again

@title Horrible Remote button script

@param f = Focus (mm)
@default f 45

@param t = Target Tv96
@default t 576

@param n = Minimum Sv96
@default n 371

@param x = Maximum Sv96
@default x 184

while 1
  wait_click 1
if is_key "remote" then
gosub "focus"
gosub "meter"
gosub "exposure"

-- get focus, if focus not locked then wait till remote trigger pressed again.
:focus
get_focus_state Z
if Z = 0 then playsound 6
get_prop 206 p
until p<>1
sleep 1000
goto "wait_interval"
wend

-- if focus okay, then
get_focus_ok
  playsound 5
  set_focus f
  set_aflock 1
  return

-- Bv (luminance), Sv (ISO), Av (aperture), Ev shift and current Tv (exposure time)
-- Get the current autoexposure values
:exposure
  p=get_av96()
  s=get_sv96()
  t=get_tv96()
return

-- once remote pressed again, then take pictures on set exposure and focus
-- turn off the backlight to save batteries
-- can we make button (maybe display button) toggle screen on off?
:takepics
while 1
  wait_click 1
  if is_key "remote" then
set_av96(p)
set_sv96(s)
set_av96(p)
shoot
set_backlight 0
wend
gosub "takepics"
end


Re: A4000IS script for bookscanning using remote trigger
« Reply #1 on: 14 / July / 2013, 16:08:39 »
I'm now a bit frustrated, as between learning to write scripts, and implementing them, I've got confused and lost.
Sorry to hear you are having trouble.  Learning to program (in any language) takes some time.   Rather than cutting and pasting code fragments like you have done,  you are better off to start simple and work up.  Begin with a script that just shoots.   Then add some code to wait for the USB remote and shoot each time it's pressed.  Once you have that done,  you can try reading exposure values after the first shot and using those values with each subsequent shot.   Auto focus lock can be added by the same process.

Quote
I haven't even tried running it as its that horrible. Please help get it running.
Well,  I looked at if for a few seconds and its not going to run the way its written.  Aside from the syntax errors the structure is basically a "redo from scratch".  Sorry - not trying to be harsh.  It just is.

Do you want to work this through yourself and learn a bit about programming. We can help with that.

 Or would you rather I just posted something that works?

Update :  script attached - I had something close that only needed a little tweak - save it as bookscan.lua on your SD card.
« Last Edit: 14 / July / 2013, 17:53:49 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: A4000IS script for bookscanning using remote trigger
« Reply #2 on: 15 / July / 2013, 10:32:17 »
Thanks for the coding suggestion. Coding is on my to do list, but its right down there in priorities along with earning money.
Thanks a million for the script. I'll try it out,
Dave

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal