Using Environment variables with @If

I would like to use an Environment variable with a @If modifier. As an example, I have an Environment variable called PROD that can be either Y or N. I would like to create a menu button that uses an
@if modifier to test this PROD variable and then act accordingly.

Bob Gregory

Scripting is the way to go here:

function OnClick(clickData)
{
	var shell = new ActiveXObject("WScript.Shell");
	var isProd = shell.ExpandEnvironmentStrings("%PROD%").toUpperCase() == "Y";

	if (isProd)
	{
		DOpus.Output("Prod");
	}
	else
	{
		DOpus.Output("Staging");
	}
}

Thank you Leo. I'll be able to use your solution in other ways.

Bob

1 Like