## CaptureLimitValue now missing

Discussions on extending SharpCap using the built in Python scripting functionality
1CM69
Posts: 62
Joined: Tue Nov 14, 2017 9:49 pm

### CaptureLimitValue now missing

Hi,

I've been going around in circles trying to debug a script & I have finally narrowed it down, I think.

I have been using:

Code: Select all

SharpCap.SelectedCamera.CaptureConfig.CaptureLimitValue

to programmatically limit the Camera Capture in seconds, i.e.:

Code: Select all

SharpCap.SelectedCamera.CaptureConfig.CaptureLimitValue = 60

Oddly, now I am getting an error, this from SC Log:

Code: Select all

Exception of type MissingMemberException from Scripting exception caught at top level. : 'CaptureLimitConfiguration' object has no attribute 'CaptureLimitValue'

I had a script using this perfectly just a couple of days ago but since then I have installed the SC 3.2 BETA

Is this a known bug in the BETA or some odd issue my end?

Cheers..,

Kirk

Posts: 3094
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

### Re: CaptureLimitValue now missing

Hi Kirk,

this is a change in 3.2 - previously CaptureLimitValue was used for both number of frames and times. Now there are two separate values to set

CaptureLimitCount (for number of frames, an integer)
CaptureLimitTime (for setting the time length of a capture - this is a TimeSpan)

Code: Select all

from System import TimeSpan
SharpCap.SelectedCamera.CaptureConfig.CaptureLimitTime = TimeSpan.FromSeconds(100)

hope this helps,

Robin

1CM69
Posts: 62
Joined: Tue Nov 14, 2017 9:49 pm

### Re: CaptureLimitValue now missing

Sat Aug 25, 2018 7:26 am
Hi Kirk,

this is a change in 3.2 - previously CaptureLimitValue was used for both number of frames and times. Now there are two separate values to set

CaptureLimitCount (for number of frames, an integer)
CaptureLimitTime (for setting the time length of a capture - this is a TimeSpan)

Code: Select all

from System import TimeSpan
SharpCap.SelectedCamera.CaptureConfig.CaptureLimitTime = TimeSpan.FromSeconds(100)

hope this helps,

Robin
Thanks Robin, I assumed it was maybe something along those lines, I must have missed it in the documentation.

So just to get this straight with the new TimeSpan attribute, is the capture time in seconds the value held in the parenthesis i.e. 100 in your example?

I am guessing too that all pre 3.2 scripts using CaptureLimitValue will need to be changed & from that point on will only function on 3.2 and above?

Is there somewhere an exhaustive list of all the numerous SharpCap attributes etc.... with explanations?

I see a limited few on the Scripting Help Page but I have mainly been finding them by using the scripting console by using the suggestion list.
This is fine and some have self explanatory names but it’d still be nice to see a glossary.

Regards..,

Kirk

1CM69
Posts: 62
Joined: Tue Nov 14, 2017 9:49 pm

### Re: CaptureLimitValue now missing

I've found an answer to my TimeSpan question: https://docs.microsoft.com/en-us/dotnet ... work-4.7.2

1CM69
Posts: 62
Joined: Tue Nov 14, 2017 9:49 pm

### Re: CaptureLimitValue now missing

Hi,

now at the stage to implement this change in my script but just need to check something quickly.

At the moment in v3.1...... a capture sequence is scripted as:

Code: Select all

SharpCap.SelectedCamera.CaptureConfig.CaptureLimitType = CaptureLimitType.TimeLimited
SharpCap.SelectedCamera.CaptureConfig.CaptureLimitValue = X

where X = (seconds)
or

Code: Select all

SharpCap.SelectedCamera.CaptureConfig.CaptureLimitType = CaptureLimitType.FrameLimited
SharpCap.SelectedCamera.CaptureConfig.CaptureLimitValue = X

where X = (number of Frames)

In this new version do I omit this line?:

Code: Select all

SharpCap.SelectedCamera.CaptureConfig.CaptureLimitType = CaptureLimitType.TimeLimited/FrameLimited

and purely place either?:

Code: Select all

SharpCap.SelectedCamera.CaptureConfig.CaptureLimitTime = TimeSpan.FromSeconds(X)

or

Code: Select all

SharpCap.SelectedCamera.CaptureConfig.CaptureLimitCount = X

regards..,

Kirk

1CM69
Posts: 62
Joined: Tue Nov 14, 2017 9:49 pm

### Re: CaptureLimitValue now missing

1CM69 wrote:
Thu Aug 30, 2018 10:40 am
Hi,

now at the stage to implement this change in my script but just need to check something quickly.

At the moment in v3.1...... a capture sequence is scripted as:

Code: Select all

SharpCap.SelectedCamera.CaptureConfig.CaptureLimitType = CaptureLimitType.TimeLimited
SharpCap.SelectedCamera.CaptureConfig.CaptureLimitValue = X

where X = (seconds)
or

Code: Select all

SharpCap.SelectedCamera.CaptureConfig.CaptureLimitType = CaptureLimitType.FrameLimited
SharpCap.SelectedCamera.CaptureConfig.CaptureLimitValue = X

where X = (number of Frames)

In this new version do I omit this line?:

Code: Select all

SharpCap.SelectedCamera.CaptureConfig.CaptureLimitType = CaptureLimitType.TimeLimited/FrameLimited

and purely place either?:

Code: Select all

SharpCap.SelectedCamera.CaptureConfig.CaptureLimitTime = TimeSpan.FromSeconds(X)

or

Code: Select all

SharpCap.SelectedCamera.CaptureConfig.CaptureLimitCount = X

regards..,

Kirk
Solved it, the 'CaptureLimitType' line does need to stay as in previous version, it is only the 'CaptureLimitValue' line that is altered depending on whether Time or Frames is set as the Limit.

Posts: 3094
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

### Re: CaptureLimitValue now missing

So, this is clearly an issue I had not anticipated for those using scripting. I originally removed the CaptureLimitValue in SharpCap 3.2 and replaced it with two separate properties because the use of CaptureLimitValue for both count and time led to some ugly and hard to maintain code within SharpCap itself.

I am therefore going to re-instate the CaptureLimitValue property for compatibility reasons with existing scripts. Internally I will flag it as 'obsolete' and will not use it within SharpCap code. What it will do is set or retrieve either CaptureLimitCount or CaptureLimitTime (depending on the CaptureLimitType set).

cheers,

Robin

1CM69
Posts: 62
Joined: Tue Nov 14, 2017 9:49 pm

### Re: CaptureLimitValue now missing

OK,

so in my script now I have a check for version number and depending on result i.e. pre v3.2 it reverts to the ‘old’ properties or if it finds version is 3.2 or above it uses the ‘new’ properties.

Can I still use this as I have implemented?

Cheers..,

Kirk

Posts: 3094
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

### Re: CaptureLimitValue now missing

Yes, of course - just hoping to save others from having to jump through the same hoops that you have had to.

cheers,

Robin

1CM69
Posts: 62
Joined: Tue Nov 14, 2017 9:49 pm

### Re: CaptureLimitValue now missing

Thu Aug 30, 2018 5:36 pm
Yes, of course - just hoping to save others from having to jump through the same hoops that you have had to.

cheers,

Robin
Excellent, thanks for the clarification Robin

cheers..,

Kirk

### Who is online

Users browsing this forum: No registered users and 1 guest