Now, the not so easy one. How should I insert the readline value into the path? This just creates a folder named 'folder? in the download path (i was somehow expecting this to happen )
elseif option == '6' then ---------DOWNLOAD
local folder=cli.readline('Folder>')
mc:cmdwait('play')
mc:download_images({dst='c:/download/folder/CAM${id}/_IMG_${shotseq}${ext}',delete=true})
Sorry to ask such basic questions, I'm slowly learning but there's still a lot to improve.
No problem, you're learning programming in a roundabout way
. The stuff in '' or "" in Lua is a string. The value from readline is also a string. In Lua, the concatenate operator .. is used to join strings together, like:
mc:download_images({dst='c:/download/'..folder..'/CAM${id}/_IMG_${shotseq}${ext}',delete=true})
And to complicate things further... This is just optional and probably rarely used option. But if I were to insert multiple values in the shoot function, it should be something like this, right?
elseif option == '4' then ---------SHOOT w/values
local dist=cli.readline('Focus Dist>') fnum=cli.readline('F number>') shutter=cli.readline('Shutter speed>') ISO=cli.readline('ISO>')
mc:shoot({sd=dist, tv=exp.shutter_to_tv96(tonumber(shutter)), sv=exp.iso_to_sv96(ISO),av=exp.f_to_av96(fnum)})
There might be some adjustments needed in order to convert the inserted values to a proper format (I still don't understand APEX96 numbers, is there any table or list?). But the structure is somehow OK, right?
That approach should be OK. You probably want to use tonumber on the ISO and fnum values as well. I would use one
local whatever = readline whatever
line for each value. local means that name is only known inside the surrounding block (if / elseif in this case), so if you used say shutter somewhere else, it wouldn't interfere.
Also, if you are using the recent multicam lua files, you can use svm= instead of sv= for ISO. This will use the normal "market" as displayed in the camera UI.
From a user interface perspective, this could be a bit annoying since there's no way to not shoot if you make a mistake in one of the values. Two possible ways to handle this:
1) Have a separate menu item to enter the values. At the top of the file, set your default values, like
shutter=1/50
ISO=50
fnum=4
dist=nil
Then have a menu item like
elseif option == '9' then
dist=tonumber(cli.readline('Focus Dist>'))
if dist == 0 then
dist = nil
end
fnum=tonumber(cli.readline('F number>'))
shutter=tonumber(cli.readline('Shutter speed>'))
ISO=tonumber(cli.readline('ISO>'))
...
And have your shoot command, just refer to those names like your example.
The if dist == 0 is there to allow you to get back to autofocus (sd=nil, meaning not set). The advantage of this is if you want multiple shots with the changed values, they stay until you quit or change them.
2) Have a final prompt to confirm after reading the values, like
if cli.readline('shoot (y/n)>') == 'y' then
mc:shoot({sd=dist, tv=exp.shutter_to_tv96(tonumber(shutter)), sv=exp.iso_to_sv96(ISO),av=exp.f_to_av96(fnum)})
end
To understand the APEX96 numbers, I'd recommend this description of APEX
http://dougkerr.net/Pumpkin/articles/APEX.pdfAPEX96 is just the same values multiplied by 96.
Or, if the theory and math isn't your thing, chdkptp can print out conversion tables, like
!exp.print_tv_table()
!exp.print_av_table()
!exp.print_sv_table()
The shutter one also gives you decimal values of the normal fractions like 1/50 etc.
Finally, I noticed your default is ISO 50. CHDK ISO overrides do
not generally allow you to go significantly lower than what's available in the Canon UI, so that's probably not useful.
edit:
typos