EasyManua.ls Logo

Canon Camera - Page 165

Canon Camera
257 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
156 CHAPTER 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 =
os.listdir(schedules,false)
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

Table of Contents

Related product manuals