Thanks for your answer .
I was trying to connect to a A2200 chdk build 1.3.0.3152 and chdkptp build r438
using a .bat file
"chdkptp.exe" -g -c -r="C:\rs.lua"
where rs.lua is :
rec
rs
quit
The connect fails when executed with the batch file but succeed when executed from the console .
1) What does "connect fails" mean? What actually happens?
I modified the bat as suggested first by removing the call to GUI second by using e instead of r :
1)----------------------------
if rssansg.bat is :
"chdkptp.exe"
-c -r="rs.lua"
if rs.lua is :
list
rec
rs
quit
then
rssansg.bat execution gives :
chdkptp.exe" -c -r="C:\Users\exavue\Desktop\reader\rs.lua"
-1:Canon PowerShot A2200 b=bus-0 d=\\.\libusb0-0001--0x04a9-0x322a v=0x4a9 p=0x3
22a s=85046B2D98F043448BDDA65F6A2726ED
ERROR: not connected
WARNING: rc rs.lua failed: error on line 2
open_camera_dev: ptp_opensession failed 0x2ff
open_camera_dev:usb_ptp_device_reset(): No such file or directory
usb_ptp_get_device_status(): No such file or directory
open_camera_dev: ptp_opensession 2 failed: 0x2ff
ERROR: connection failed
2) --------------------------------------------
with rsgce.bat
chdkptp.exe"
-g -c -e=" rs.lua"
starting gui...
with the error message on the GUI
connected: Canon PowerShot A2200, max packet size 512
ERROR: unknown command 'C'
UPDATE: the message originates during function cli:execute(line) at line 269 of cli.lua
OOPS : forgot "source" in the command line
try with :
chdkptp.exe" -g -e="source C:\rsconnect.lua"
where rsconnect.lua is
connect
list
rec
list
rs
quit
gives in GUI
connected: Canon PowerShot A2200, max packet size 512
*1:Canon PowerShot A2200 b=bus-0 d=\\.\libusb0-0001--0x04a9-0x322a v=0x4a9 p=0x322a s=85046B2D98F043448BDDA65F6A2726ED
*1:Canon PowerShot A2200 b=bus-0 d=\\.\libusb0-0001--0x04a9-0x322a v=0x4a9 p=0x322a s=85046B2D98F043448BDDA65F6A2726ED
ERROR: not in rec mode
ERROR: error on line 5
Note: The GUI is very useful to monitor the image ( and debug )
It seems to me there is a timing problem .
When the CHDKPTP commands are typed from the console in the GUI , it works but then they are included in the "rs.lua" , the "connect" command may not not have the time to complete before the next command tries to execute.
Update : it seems to be true also for the "rec" command in the rsconnect.lua example