CaptureSingleFrameTo issue

Discussions on extending SharpCap using the built in Python scripting functionality
Post Reply
stbkaiser
Posts: 155
Joined: Wed Aug 15, 2018 2:57 pm

CaptureSingleFrameTo issue

#1

Post by stbkaiser »

HI
Trying to capture a file to my drive using CaptureSingleFrameTo

Here is the script
SharpCap.SelectedCamera = SharpCap.Cameras [0] # Open the first camera in the Cameras menu and start previewing it
time.sleep(4)
SharpCap.SelectedCamera.Controls.OutputFormat.Value = "TIF files (*.tif)"
SharpCap.SelectedCamera.CaptureSingleFrameTo("d:\shared\test.tif")
SharpCap.SelectedCamera = None # close camera

The problem:
The Sharpcap msg banner says it captured to D:\\shared_est.tif
How would I capture to a sub directory?
Thanks
User avatar
admin
Site Admin
Posts: 13344
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: CaptureSingleFrameTo issue

#2

Post by admin »

Hi,

the '\' is an escape character in python, so you are \t gets you a tab (not sure what \s is). Use double backslash if you want an actual backslash character in the string.

Code: Select all

SharpCap.SelectedCamera.CaptureSingleFrameTo("d:\\shared\\test.tif") 
cheers,

Robin
Post Reply