This solution sounds interesting. I just need the sleep syntax. thanks
In chdkptp, you can use sys.sleep() to wait for a given number of milliseconds. You can use Lua standard os.date(), os.time() and os.difftime (
http://www.lua.org/manual/5.2/manual.html#6.9) to do various things with time and date.
See
https://app.assembla.com/spaces/chdkptp/wiki/Scripting_Guide for some general information about scripting chdkptp.
if Time between 5am and 11pm {execute ultimateModifiedForOneDayOnly (next command waits until this is done. Is that possible?)}
if Time between 11pm and 5am {download and delete all images from camera, and then sleep until 5am}
For a once (or a few times) per a day command, you might consider just using OS scheduling (cron on *nix, windows task scheduler) to run chdkptp. If you pass commands with -e it will run them and exit when complete. So you could have a job that runs at 5 AM and does
chdkptp -c -e"lua loadfile('A/CHDK/SCRIPTS/ultimate.lua')()"
and another that runs at 11:00 PM
chdkptp -c -e"imdl -rm"
It is possible to check if a script is running on the camera, but it might be simpler to just set up the scheduling so ultimate quits before the download runs.
if Time between 5am and 11pm
{
remoteshoot
sleep(x)
}
In chdkptp lua you could do this something like
interval = 1000*60*10 -- 10 minutes in milliseconds
while true do
local hour=os.date('*t').hour
if hour >= 5 and hour <23 do
cli:execute('remoteshot')
end
sys.sleep(interval)
end
This would go in a file (say, myfile.lua) which you could run in chdkptp with
chdkptp -e"exec dofile('myfile.lua')"
caveats:
1) This is untested, off the top of my head
2) No way is provided to gracefully exit, to stop it you'd have to control+C or kill the process
A more complete example of this kind of approach can be found in
https://chdk.setepontos.com/index.php?topic=13261.msg134971#msg134971