I’ve been able to successfully experiment with some complex Python code so I wanted to share some starter code so we can build useful community tools…
Public Class TestClass
Private Host As IScriptingHost
Public Property ScriptingHost() As IScriptingHost Implements IScriptObject.ScriptingHost
Set(ByVal value As IScriptingHost)
Host = value
Public Sub Execute() Implements IScriptObject.Execute
Dim pythonProcess As New Process()
Dim pythonProgram As New ProcessStartInfo()
pythonProgram.FileName = "C:\<REPLACE THIS WITH PATH TO>\Python39\python.exe" 'Default Python Installation
pythonProgram.Arguments = "C:\<REPLACE THIS WITH PATH TO>\TkinterDemo_v1.py"
The Tkinter demo code is,
# Creates a simple Tkinter Message Box
from tkinter import messagebox
from tkinter import *
root = Tk()
messagebox.showinfo("Tecan Fluent Python", "Hello Lab Auto Forum!")
Have you incorporated Python scripts into your workflow? How far down the rabbit hole have you gone?
New Fluent learner here. This VB Script would be executed by FC, correct? What extra capabilities, if any, does this present over having FC Start Application a batch file which runs a Python script?
Appreciate your guidance!
I don’t know anything about your company or it’s setup but biotech labs vary big time. I love the line, “if you’ve seen one lab, you’ve only seen one lab.” They vary drastically and that’s true with regard to quality, compliance and architecture. On security alone, I think some automation setups are going be in a for a rude awakening especially as the field continues to secure massive funding wins. With that said,
- It’s first and foremost an alternative to an EXE
- Minimizes need for expertise in VB
- Allows you to use any existing Python code base
- Some place have to register every EXE with software like CrowdStrike (imagine having to do this at scale for large biopharma and imagine having to document each one to ensure there’s not a security problem…)
- Some places won’t allow EXE’s to run period. Not even an option.
- Faster iterative process for development
- Because you can.
I found a different way of doing the same kind of thing, although my method is a lot less clean.
I open a command prompt with /K in the start of my command line argument, then I can chain as many commands as I like after each other with “&” separating each line.
Pretty flexible - everything you can do from a cmd you can do here, open specific python environment, run script etc
Gets very messy very quickly!!
You can only get the error code, not the error message if you end with “& exit”
I thinks this could be a nice tool depending on the task and place, and its always nice to see how others would solve similar tasks
That’s very clever!
I like to standardize my calls in subroutines because it’s good code practice but also because it allows me to narrow the scope for operators/other developers. Your version is way more versatile but potentially a security nightmare… would CrowdStrike block it?
With this simple code structure, I wrote an arg parser for my Slack Messaging that manages the white space problem in FC and pings specific scientists when their runs are complete.
I also connected my runs to Benchling so I could send over Metadata about my runs.
Next steps are total dB integration, preferably NoSQL but my start with SQL since they’re easy to spin up.
I do not know what kind of security measures would block this - my guess is that it wouldn’t block it, but I don’t know.
I would like to know how to query a database through Fluent Control, the command line method doesn’t leave any good options for moving variables into Fluent Control - I have only just started making small VB.Net scripts to delete files and other simple tasks.
I’m happy to share a quick template with the community.
Give me a few days to spin up something.
There are lots of things you can do in VB scripts including run sql statement. You can find many examples by searching online.
I’ve made an entire application to build worklists based on sample information such as dilution factor and sample type for liquid classes to use. I then have a configuration file that defines the labware names and wells available so it knows where everything needs to go. This way I can use different volumes and liquid classes without having to program them every time. Different volumes, different liquid classes, different vial sources all gets taken care of through python on the gwl before the run. I even have it calculating volumes of reagents I need with a little dead volume added for safety and Softmax file for the template on the plate reader. Same deal for a gyrolab instrument.
So someone reached out about the app I created for worklists. So I’ve been trying to see what my employer allows me to divulge. I actually received permission to present it for the SLAS 2024 conference poster sessions. If anyone is in Boston for it, I’ll gladly explain everything there. I’m going to work with my employer and hopefully open-source the software in the upcoming months.