Insert timestamp with a python script

Discussions on extending SharpCap using the built in Python scripting functionality
michastro
Posts: 19
Joined: Wed Jan 22, 2020 12:10 pm

Re: Insert timestamp with a python script

#21

Post by michastro »

no no, NINA launch Sharpcap, with the extension /runscript to use a python script, when finished, Nina continus its work. But sure, Sharpcap is the best program for occultation with the tilmestamp inserted in the .ser video.
User avatar
admin
Site Admin
Posts: 13408
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Insert timestamp with a python script

#22

Post by admin »

Ok, in that case, change NINA to run a batch file with parameters, and then write the batch file to put some of the parameters into a text file and use the others to launch sharpcap with /runscript.

Something like...

Code: Select all

for /f "tokens=1,* delims= " %%a in ("%*") do set ALL_BUT_FIRST=%%b
echo %ALL_BUT_FIRST% > f:\params.txt
"c:\Program Files\SharpCap 4.1 (64 bit)\SharpCap.exe" /runscript %1
The rather cryptic first line collects all but the first parameter to the batch file and then the second line writes all those parameters to f:\params.txt (change name of this file to suit). Finally it runs SharpCap with the script specified in the first parameter. Your script can read f:\params.txt to recover the extra parameters.

Use it like this

Code: Select all

RunSharpCapWithParams.bat f:\testme.py param1 param2
Which will make SharpCap load f:\testme.py and will put 'param1 param2' into f:\params.txt for the python to read

cheers,

Robin
michastro
Posts: 19
Joined: Wed Jan 22, 2020 12:10 pm

Re: Insert timestamp with a python script

#23

Post by michastro »

Hello Robin,
Congratulations!! Everythings is ok, the .py start properly and the exit command works also in the python script.
Thanks a lot
Michel
Post Reply