Accesing and using FWHM Measurement Transform

Discussions on extending SharpCap using the built in Python scripting functionality
Post Reply
JesusRL
Posts: 70
Joined: Wed Aug 05, 2020 4:36 pm
Location: Madrid

Accesing and using FWHM Measurement Transform

#1

Post by JesusRL »

I would like to add to my imaging script the hability to perform an autofocus routine to be triggered based on number of frames or temp threshold.

I have everything ready, but the core of the function, as I am unable to manage the focusing Transform.

The steps I want to run are:

1) Move the focuser "In" 5 times the "scan step size" (easy and already working)
2) Open the Transform. I am able to open it via:
SharpCap.Transforms.SelectTransform("FWHM Measurement")
though it gives me an error (translated from spanish, language of my OS) equivalent to "the subprocess that makes the call cannot use the object
because it does not own it"
3) PRESS "Out" button and be notified (or make a while loop checking for it to finish). I could even make an external estimate of duration and it is not
the main concern at all.
4) PRESS the "Best position" button

Obviously when I say PRESS I mean access the function under these buttons, but said that way for clarity

Can anyone help me on this?

Thanks and regards in advance
User avatar
admin
Site Admin
Posts: 13177
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Accesing and using FWHM Measurement Transform

#2

Post by admin »

Hi,

I'm afraid that accessing the buttons in the UI via the scripting language is not something that is either currently possible or planned to be added in the future. That being said there may be workarounds - there are tools that allow you to find UI components in Windows applications and interact with them. For example there is a Python library called pywinauto that apparently supports this (I've not tried this particular library and I don't know if it can be loaded into the Python interpreter inside SharpCap, but it certainly seems an interesting prospect).

Note that SharpCap 3.3 will have a built-in action sequencing tool – while in some ways this is less sophisticated than the Python scripting language it will have access to more actions – it has the prototype of a autofocus action already.

Thanks, Robin
JesusRL
Posts: 70
Joined: Wed Aug 05, 2020 4:36 pm
Location: Madrid

Re: Accesing and using FWHM Measurement Transform

#3

Post by JesusRL »

Thank you Robin, I'll try that way.

Knowing about your new sequencing tool. Are you thinking on including a "wildcard" of the type "run a specific script" inside the sequence?

This could be very helpfull to include own needs wothout the need of scripting the full sequence management, as is needed now.

T&R
User avatar
admin
Site Admin
Posts: 13177
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Accesing and using FWHM Measurement Transform

#4

Post by admin »

Hi,

yes, there is the option to run a python script as one of the steps in the sequence. Who knows what will be possible with the combination ;)

Robin
Post Reply