Page 2 of 2

Re: Execute a focus assistant tool from script

Posted: Sat Nov 01, 2025 1:32 am
by mdborland
Robin,

Unfortunately,I really need to run autofocus from a python script. I don't see a way to implement my data collection in the sequencer.

Hope you can find a solution.

--Michael

Re: Execute a focus assistant tool from script

Posted: Sat Nov 01, 2025 11:37 am
by admin
Hi Michael,

the workaround for now until I fix it would be to use the script to run a one line sequence

Code: Select all

SharpCap.Sequencer.RunSequenceFile('path\to\one\line\sequencefile.scs')
I will try to fix it for direct access from scripting in the next update.

cheers,

Robin

Re: Execute a focus assistant tool from script

Posted: Sat Nov 01, 2025 6:38 pm
by mdborland
Robin,

The workaround solves the problem.

Thanks.

--Michael

Re: Execute a focus assistant tool from script

Posted: Wed Apr 15, 2026 5:52 am
by graems
I am using scripting to automate my telescope/focuser/camera for occultation recording through the night. I use temperature compensated focusing to keep focus in the right ballpark through the night. I also like to run SharpCap.RunRefocus before each occultation to be more precise. But there are cases where the RunRefocus might fail (clouds) and the focus window stays open. At high frame rates this can cause an extra 20% loading on my processor which I would like to avoid during camera recording.

Is there a method available to close the focus window from scripting or sequencing commands or pause its functioning?

Thanks
Graem

Re: Execute a focus assistant tool from script

Posted: Wed Apr 15, 2026 2:54 pm
by admin
Hi Graem,

yes, you can close the focus tool from scripting with something like

Code: Select all

SharpCap.Transforms.SelectedTransform = None
It is important not to do that until the refocus attempt has completed though - if you do it while it is still in progress then it will probably cancel/fail the refocus. The default behaviour of the tool remaining open on a failed refocus is deliberate, but aimed at interactive use - in the case of a failure, viewing the focus graph to see what might have happened is probably informative.

cheers,

Robin

Re: Execute a focus assistant tool from script

Posted: Thu Apr 16, 2026 5:48 am
by graems
Thanks Robin - that works great (from my limited testing as it is currently snowing).

Using the following commands:
SharpCap.SafeGetAsyncResult(SharpCap.RunRefocus())
SharpCap.Transforms.SelectedTransform = None

Graem