Can periodic Python tasks be installed?

Discussions on extending SharpCap using the built in Python scripting functionality
Post Reply
lowenthalm
Posts: 152
Joined: Mon May 07, 2018 12:27 am

Can periodic Python tasks be installed?

#1

Post by lowenthalm »

I want to record camera cooler behavior periodically, probably every 30 seconds or so. Is there a way of installing Python script or function object that is called periodically?
User avatar
admin
Site Admin
Posts: 13350
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Can periodic Python tasks be installed?

#2

Post by admin »

Hi,

not sure if it is possible with raw python, but you have the whole of the .NET framework class library available to you because it is IronPython, so somethinf like this will work

Code: Select all

clr.AddReference("System.Windows.Forms")
from System.Windows.Forms import Timer
def tick(sender,args):
 	print ("hello")
t = Timer()
t.Interval = 30000
t.Tick += tick
t.Start()
#later
t.Stop()
cheers,

Robin
Post Reply