Transferring of variables between Python and IDEAScript

3 posts / 0 new
Last post
BVisser
Offline
Joined: 09/18/2020 - 13:47
Transferring of variables between Python and IDEAScript

 
Does anyone know if it is possible to send variables generated in a python script to be used in an IDEAScript? I've got an existing Python script that converts an XML-file into a CSV-file using the pandas module that is called from an IDEAScript using .runpython module in IDEA10.4. However there are also several built-in checks to ensure the completeness and accuracy of the information as well as the location where the file is saved which is stored in variables within the Python script. Is it possible to send these variables with their values to the IDEAScript that calls the Python script to perform these checks within IDEA? Or is this not possible and should I export these values in a textfile and then import this new file into IDEA to use the values of the variables? 
 
 
 
 

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Your only option is the Client.RunIDEAScriptRV.  It only allows for 4 variables.  If you need more then you will have to transfer it through a text file. Below is from the language browser.

Client.RunIDEAScriptRV

Run another IDEAScript macro and return four variables to the caller. In order for values to be returned, the called macro must assign the values back to the global constants arg1, arg2, arg3, and arg4, respectively.

Syntax

Client.RunIDEAScriptRV(scriptName As String, arg1 As Variant, arg2 As Variant, arg3 As Variant, arg4 As Variant )

Parameters

[in] scriptName

The macro to be executed.

[in/out] arg1

First parameter, which is also used as a return value.

[in/out] arg2

Second parameter, which is also used as a return value.

[in/out] arg3

Third parameter, which is also used as a return value.

[in/out] arg4

Fourth parameter, which is also used as a return value.

Return Value

Variant

Remarks

Control always returns to the next step of the calling macro when the called macro finishes executing.

If the full path of the file is not specified and only the file name is specified, IDEA limits its search to the root folder of the active project.

If the macro resides in a sub-folder in the active project, you must specify the sub-folder name. For example, Client.RunIDEAScriptEX "Temp\MyScript.ISS", "Hello", "", "", "".

Type

None

Example

Sub Main

' Create input values for an IDEAScript macro.

Arg1 = "Hello"

Arg2 = "Goodbye"

Arg3 = "Blue"

Arg4 = "Green"

' Start another IDEAScript macro.

Client.RunIDEAScriptRV "MyScript.ISS", Arg1, Arg2, Arg3, Arg4

' Display the return values.

MsgBox "The return values are: " & Chr(13) & _

Arg1 & Chr(13) & Arg2 & Chr(13) & _

Arg3 & Chr(13) & Arg4

End Sub

BVisser
Offline
Joined: 09/18/2020 - 13:47

Hi Brian, Thank you for the quick response. I will use a text file then. Thanks for all of the effort you put in this site, it is amazing and greatly appreciated.