Forum Discussion

IuliaVascan's avatar
IuliaVascan
Occasional Contributor
3 years ago
Solved

Passing variables from TC

Hi,   I want to pass some variables from a TC script to another tool. I run the script from TC via command prompt. Now I have a variable called 'battery_colour' which I want to read it and also c...
  • AlexKaras's avatar
    AlexKaras
    3 years ago

    Hi,

     

    Or it can be done directly [...] but in an opposite way?

    No, basically not.

    There are two ways (scenarios) how applications can interact with one another. And each way has several options.

    First way is when first application (app A) generates some result data, terminates and another application (app B) is started then somehow and expects to process the data from the first application. This is your case if I got you right.

    With this scenario, app A must provide resulting data to some persistent or temporary storage provided by OS. Usually this is either file, or environment variable, or a pipe (redirection).

    In order the pipe can be used, app A must output its data to standard OS output. Like dir command does. In this case pipe can be used like this: dir c: | sort. However TestComplete does not provide data to standard OS output and thus this option is not available to you.

    So basically you are left with either file or environment variable ones.

     

    The second way is when app A does not terminate after result data are generated but continues to run and calls/spawns app B from within the code.

    Usual options for this scenario are either process spawning (using generated command line for app B) or interaction with app B via COM calls or some queue. As options for this scenario are implemented in code within app A, code in app A can directly get and use values of its internal variables (project variables in your case) to create proper command-line strings or required data structures.

    But this scenario is not your one and thus we do not consider it.