04-24-2017 11:42 AM
How do I specify which TestStand 2016 environment to use when running from a custom operator interface? I want to create multiple environments but I don't know how I can have my software ensure I am using the right environment.
Solved! Go to Solution.
04-24-2017 01:08 PM
You can specify an environment through the command line when you launch the operator interface (TS Help: Choosing an Environment). I like to make a shortcut that already has the /env specified, similar to how the full featured OIs specify the /editor or /operatorInterface flags.
From your OI code, you can call Engine.GetEnvironmentPath to check the current environment and react appropriately.
04-24-2017 03:00 PM
The question is, once I know the environment I'm in, can I programmatically change it or does it require the user to open the Sequence Editor?
04-24-2017 04:11 PM
Changing environments requires exiting the existing application instance and launching a new one. You could programmatically re-launch your application with the correct environment, but there's no way around restarting it if you need to change environments.
The engine reads some config files on initialization, so it needs to be started with the environment you want to use.
05-01-2017 04:33 PM
It would be nice if I could programmatically set the environment in the AxApplicationManager when it gets initialized or something like that. Perhaps a future version will allow that. Thanks for your response.
10-30-2018 06:22 PM
I would like to pass an environment to the Engine as well, especially when I am debugging my TSUI. Right now I have to add information to the Global environment in order to debug the OI. That is slow goin' and hard to explain. I see this as very similar to a Python virtualenv, where the shell can be activated to use said env. To follow that logic, I tried setting the "TestStand" environment variables of a cmd.exe instance to my AppData and PubDocs folders. When I ran seqedit.exe from that cmd.exe I was hoping the engine would use those environment variables and launch in a fake Global environment that I had overridden.
That didn't work I guess seqedit has hardcoded Global environment settings?
I don't see why the Application Manager's GetEngine() method couldn't include an override for providing an environment file.
Another option would be to allow the setting of the Application Managers' CommandLineArgs. I tried to use the .Add() method on that but it errors and says you cannot set these strings.
I agree that we need to be able to, somehow, pass environments in programmatically.
10-31-2018 07:59 AM
Since the Environment is needed to initialize the engine, it needs to be set before creating one. This is possible with a customOI similar to what is described here:
For the sequence editor, you're limited to command line args.
10-31-2018 08:13 AM
Good to know. I use a custom OI to execute the sequences but typically edit them in the sequence editor.
10-31-2018 10:36 AM - edited 10-31-2018 10:37 AM
If this to say that the ApplicationManager that I use to call GetEngine() has already loaded the engine and, therefore, config files?
I understand the complexity if that is the case.
10-31-2018 11:03 AM
That's right