spot meter mode switch ubasic - works but ... - Script Writing - CHDK Forum

spot meter mode switch ubasic - works but ...

  • 8 Replies
  • 5058 Views
*

Offline pdh

  • *
  • 7
spot meter mode switch ubasic - works but ...
« on: 16 / August / 2012, 18:24:18 »
Advertisements
i am after a way of having my ixus750 (sd550) boot into spot-metering mode (it doesn;t retain this setting)

the code below seems to work, ugly and crude as it is, and i have it set to autostart.
the problem is that  it switches raw mode off every time it runs, and raw mode is why i use chdk ...
i'm no programmer as you will be a ble to tell ... what do i need to do to fix it up?

Code: [Select]
@title set-spot-meter
click "set"
sleep 500
click "up"
sleep 500
click "up"
sleep 500
click "up"
sleep 500
click "right"
sleep 500
click "right"
sleep 500
click "set"
sleep 500
exit_alt 0

Re: spot meter mode switch ubasic - works but ...
« Reply #1 on: 16 / August / 2012, 19:10:32 »
A small etiquette request here ?  Please don't post the same thing in multiple threads (or start new threads with the same posting as an existing thread).  This is not a busy forum and many of us watch all postings.

Thank you.

http://chdk.setepontos.com/index.php?topic=8552.msg89460;topicseen#msg89460

Update :  this is not just because of how much it annoys the grumpy people who tend to provide most of the answers here.  When you post twice,  the responses get mixed up and confusing as the same question gets answered in slightly different ways and related new questions are brought up.
« Last Edit: 16 / August / 2012, 21:35:27 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline pdh

  • *
  • 7
Re: spot meter mode switch ubasic - works but ...
« Reply #2 on: 17 / August / 2012, 02:44:39 »
I wasn't intending to multiple post. I am aware of forum etiquette in general regarding cross-posting.

having got the answer I sought in a different thread about whether this was possible I thought it more appropriate to post a request for assistance with a specific script in the script forum rather than a general help forum

I expected had I posted this further query in the other thread I would have been told I should have posted it here ... which was what I was trying to avoid.

*

Offline pdh

  • *
  • 7
Re: spot meter mode switch ubasic - works but ...
« Reply #3 on: 17 / August / 2012, 03:20:19 »
I have marked the original thread as "Solved" and posted a link there to this thread.

I hope this keeps things tidy for everybody.

Re: spot meter mode switch ubasic - works but ...
« Reply #4 on: 17 / August / 2012, 11:47:42 »
I have marked the original thread as "Solved" and posted a link there to this thread.
Thanks.

If nobody else gets to this first,  I'll find a few minutes tonight to experiment with your script on my cameras.  The only thing I might suggest without testing is to add a sleep 1000 right after the @title line and before the first click " set".


Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: spot meter mode switch ubasic - works but ...
« Reply #5 on: 17 / August / 2012, 14:32:50 »
The 'click method' is not the best solution and camera dependent.

The propertycase for the metering mode is writeable. So we can set the metering mode via set_prop. The examble script is written in Lua, because it is more comfortable. The script makes three shots with different metering modes. You can check the exif data.

Code: (lua) [Select]
--[[
********************************
metering mode: 0=mf,1=spot,2=cnt
********************************
@title metering mode
]]

function get_metering_method()
    if get_propset()==1 then mm = get_prop(9)
    elseif get_propset()==4 then mm = get_prop(157)
    else mm = get_prop(155)
    end
return mm
end

function set_metering_method(n)
    if get_propset()==1 then set_prop(9, n)
    elseif get_propset()==4 then set_prop(157, n)
    else set_prop(155, n)
    end
end

for i=0, 2 do
    set_metering_method(i)
    print("Shoot:", i+1, "metering mode:", get_metering_method())
    sleep(3000)
    shoot()
end

msl

edit: added propset 4 in script
« Last Edit: 17 / August / 2012, 15:18:52 by msl »
CHDK-DE:  CHDK-DE links

Re: spot meter mode switch ubasic - works but ...
« Reply #6 on: 17 / August / 2012, 18:14:34 »
So for the OP's camera (sd550 has propset 1), his uBASIC startup script could be as simple as :

Code: [Select]
@title set-spot-meter
set_prop 9 1
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: spot meter mode switch ubasic - works but ...
« Reply #7 on: 17 / August / 2012, 18:53:27 »
... and also a camera independent solution with Lua:

Code: (lua) [Select]
--[[
@title set-spot-meter
]]
proptable=require "propcase"
set_prop(proptable.METERING_MODE, 1)

msl
CHDK-DE:  CHDK-DE links

*

Offline pdh

  • *
  • 7
Re: spot meter mode switch ubasic - works but ...
« Reply #8 on: 27 / August / 2012, 09:54:48 »
I haven't responded because I haven't seen notifications of replies -  so, many thanks for all these suggestions and scripts.

I did get round to adding a 1000ms pause at the beginning but raw mode is still turned off

 the set_prop versions look more elegant & I will try them out when I have a moment & report back.

thanks again
« Last Edit: 27 / August / 2012, 09:57:09 by pdh »

 

Related Topics


SimplePortal © 2008-2014, SimplePortal