Thanks very much for the help. I think I see what you mean regarding "using cli commands (like remoteshoot) and check status in Lua."
With the following command:
con 11> !t=cli:execute 'remoteshoot('/home/foo/Videos','-jpeg',{"shots=1"})'
The shot is successful. Output from the cmd in chdkptp is more verbose, and appears to give a status code of 1
I assume the error is related to bad Lua syntax - but did I understand you correctly about the errorlevel output I should expect to see?
In this case, the there was a lua error() trying to run you command, so you got a stack trace. The :1 at the very end means it was in line 1 of the code you gave to the ! command. This will pretty much always be 1, because you can only enter one line from the console.
The stuff further up the stack trace should give you a better idea of where the error happened. I'm not sure exactly what failed because the line numbers don't appear to match the current chdkptp source, but the use of cli:execute wasn't quite correct.
cli:execute expects a single string, just as you would enter on the command line. So for remoteshoot, you could do something like
!return cli:execute'remoteshoot /home/foo/Videos -jpg -shots=1'
This will display the return values.
If you want to exit chdkptp with an error code when it fails, you could do something like
!status,msg=cli:execute'remoteshoot /home/foo/Videos -jpg -shots=1' if msg then print(msg) end if not status then os.exit(1) end
This will print any output or error message from the command, and then exit chdkptp with a status code of 1 if the command failed. It prints msg regardless of status because some cli commands return their output on success.
If you need to build the remoteshoot command with code, getting the path from a variable or something like that, you can use the string concatenation operator ..., or string.format like
!return cli:execute(string.format("remoteshoot %s -jpg -shots=%d",output_path,shot_count))
this assumes output_path and shot_count are variables set earlier