I have some code in a button that is supposed to set some environment variables, then close the existing document and create a new one. Although the close and create is working, the environment variables are not being set. I’ve added prompts in various locations in the code to see what is happening, and I’ve tried setting a variable to a hard-coded string to see if it’s a problem with access to fields. Here’s the code, with the results commented.
@Prompt([ok]; “fileType”; fileType); 'this displays the correct value of the fileType field
@SetEnvironment(“fileType”; fileType);
@SetEnvironment(“fileLocation”; fileLocation);
@SetEnvironment(“mediaType”; mediaType);
@SetEnvironment(“comments”; comments);
@SetEnvironment(“printingNum”; printingNum);
@SetEnvironment(“testString”; “testString”);
@Prompt([Ok]; “varBeforeSave”; @Environment(fileType)); 'this displays blank
@Prompt([Ok]; “varBeforeSave”; @Environment(testString)); 'this displays blank, so even setting the environment to a hard-coded string isn’t working
'all other prompts beyond this are blank
@Command([FileSave]);
@Prompt([Ok]; “varAfterSave”; @Environment(fileType));
@Prompt([Ok]; “varAfterSave”; @Environment(testString));
@If(ok=“true”;
@Do(
@Prompt([Ok]; “varInsideDo”; @Environment(fileType));
@Prompt([Ok]; “varInsideDo”; @Environment(testString));
@Command([CloseWindow]);
@Command([Compose]; “fmPreserveTC”)
);
“”);
The results are the same whether I use @SetEnvironment or just @Environment. So it seems like no matter what I do, the environment variables are not getting set. I had thought maybe my notes.ini file was corrupt on this machine, so I tested it on three other machines with the same results. I’ve never had problems setting environment variables before - what could the problem be?