ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How to call VBScript from Python script

Hi,

 

I am using DIAdem 2022 and trying to use two scripts together.

One is VBScript and another one is Python script. I want to call the VBScript as Python functions, which could pass parameters and return results.

 

Are there built-in functions that allow me to do that? I find article close to it, but it does not contain the solution I need. Calling VB and Other Scripts From Python Script in NI DIAdem - NI

 

Otherwise, one solution may use JSON to pass parameters.

 

0 Kudos
Message 1 of 2
(6,283 Views)

Hello botbob,

 

„ScriptStart“ is the command to call a VBS function out of Python. The easiest way to exchange data between Python and VBS is a global defined variable.

 

Python Script:

dd.GlobalDim("myPara")
dd.myPara = 2
dd.ScriptStart("d:\\test\\vbstest.vbs", "CallPrint")

 

VBS Script:

sub CallPrint
  select case myPara 
    case 1
      msgbox "1. Hallo"
    case 2
      msgbox "2. Hallo"
  end select
end sub

 

Greetings

Walter

0 Kudos
Message 2 of 2
(6,247 Views)