Canon Camera Hackers Manual page 165

Camera hackers manual berthold daum
Table of Contents

Advertisement

156
C H A P T E R 5
Scripting
Finally, the function tohms() is already known from the Accurate Time Lapse
script:
function tohms(ticks)
local ts = idiv((ticks + 50), 100)
local t = ts % 10
ts = idiv(ts, 10)
local s = ts % 60
ts = idiv(ts, 60)
local m = ts % 60
local h = idiv(ts, 60)
return h, m, s, t
end
Now the real script execution starts. The schedule files in folder SCHED/ are
fetched. The program then runs through a loop to let the user select one of
those files. The index of the selected file is stored in variable i. We have al-
ready seen similar code in the script for file renaming.
files, msg =
if not files then
error(msg)
elseif not files[1] then
error("No schedule file")
end
i = 1
while true do
cls()
print("Press SET to select")
print("LEFT, RIGHT to scroll")
print("DISP to abort")
print("Schedule: "..files[i])
wait_click(5000)
if is_pressed("set") then
break
elseif is_pressed("display") then
i = nil
break
elseif is_pressed("left") then
i = i - 1
if i <= 0 then i = #files end
os.listdir(schedules,false)

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Powershot sx10 is

Table of Contents