Passing Variable Values From Python Script To Sensetalk Script

Hi

I want to pass a variable from a python script to a sensetalk script using subprocess.

Can I do that?

Is there anything that I need to think about (i.e. use of eggdrive)?

OR

Is it the same way I would pass a value from python to any other script written in any other language?

ALSO

Please provide an example of how I would do this.

@SenseTalkDoug

browserName = ‘Chrome’
result = server.execute (‘DoubleClick "’ + browserName + ‘"’)

That code has nothing to do with passing variables from python to sensetalk.

Hey @StephenHamilton,

Here are two examples that should work and I hope I understood your request correctly

server.execute ('run myscript (param1, params2)')
server.exeucte (' "mytestcases/Test1".initialLogin "KarstensUserName" ')
server.exeucte (' "mytestcases/Test1".initialLogin ' + PythonVariableUserName)
  1. send the command to run the script with the name Myscript that has two input parameters defined (params at the top of you script.
  2. Run the Handler initialLogin with the parameter value KarstensUserName
  3. runs the handler initialLogin with the parameter value of the the python variable PythonVariableUserName

Here you can find some brief documentation about eggDrive which you most likely have found already.

Some considerations around EggDrive:

  • Eggdrive is sequential
  • one eggdrive instance only accepts one session and command at a time. (I think thats the case)
  • multithreading is not support at least that I am aware of
  • I don’t know if we support subprocess. Sorry

What is your use case that you are considering eggdrive?

Cheers,
Karsten

Yes, you can pass variable values from a Python script to a SenseTalk script using the subprocess module. The process is similar to passing variables to any other language script. You’ll need to use the appropriate method for handling arguments in SenseTalk. Here’s an example using subprocess.run(). For detailed learning, CETPA Infotech offers the Best Python Course.