Canon Camera Hackers Manual page 202

Camera hackers manual berthold daum
Table of Contents

Advertisement

later want to rename this file (e.g., on a PC) and give it a more meaningful
name:
os.mkdir(configs)
if newconf then
ccount = ccount+1
new_name =
"conf"..ccount..".CFG"
copy_file(current_config,
configs.."/"..new_name)
print("Saved as "..new_name)
end
Now we are ready to switch to the selected configuration. We update the
INI file; if the current configuration has changed or if the user wants to
switch the configuration, we copy the selected configuration file to the
current configuration. So, by not selecting a different configuration file and
pressing SET, the user can reset the current configuration to its initial state.
If the user does not switch or reset the configuration, we simply update the
INI file:
if selected_config then
write_ini(
selected_config, ccount)
if changed or config_name ~=
selected_config then
copy_file(configs.."/"..
current_config)
print(
"Please restart camera")
shut_down()
end
elseif new_name then
write_ini(new_name, ccounend
This script is far from trivial, but it is developed with safety in mind. If
something goes wrong, you can still retrieve a working configuration from
the .BAK files.
Scripts like this are almost impossible to develop without a good debug
environment on a PC. We will discuss this topic in the next section.
selected_config,
5.7 Example scripts
193

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Powershot sx10 is

Table of Contents