Setting the computer time from a script

Discussions on extending SharpCap using the built in Python scripting functionality
Post Reply
Jean-Francois
Posts: 402
Joined: Sun Oct 13, 2019 10:52 am
Location: Germany

Setting the computer time from a script

#1

Post by Jean-Francois »

Hello Robin,

With the QHY-174GPS, it is possible to set the time of the computer with the time coming from the camera GPS.

Is it possible to do the same from a script ?
My idea is to have the time set at the beginning of my script.

Regards,
Jean-Francois
User avatar
admin
Site Admin
Posts: 13350
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Setting the computer time from a script

#2

Post by admin »

Hi,

it's non-trivial to try to set the system time from within SharpCap IronPython - you have to declare a class with special attributes to allow calling SetSystemTime from kernel32.dll - it's probably easier to launch a power shell script to do the same using Set-Date which is built into PowerShell.

https://learn.microsoft.com/en-us/power ... rshell-7.4

cheers,

Robin
Jean-Francois
Posts: 402
Joined: Sun Oct 13, 2019 10:52 am
Location: Germany

Re: Setting the computer time from a script

#3

Post by Jean-Francois »

Hello Robin,

OK, not so easy. I will first do it manually.

Jean-Francois
Post Reply