Copy link to clipboard
Copied
Hello fellows,
On my Win 7 system, I've redefined the HOME environment variable as C:\Users\bnks (by default, it's C:\Documents and Settings\Users\bnks).
I'd like to save an FM file to C:\Users\bnks\Checkout\Test\, so in my extendscript, I've defined the following variable:
var docLib = "~\\Checkout\\Test\\";
where the tilde (~) should be parsed by extendscript as the HOME environment variable (according to Chapter 3, “File System Access” in the JavaScript Tools Guide).
Unfortunately, the tilde is ignored when I try to save the file:
...
var dname = docLib + rName + ".fm";
doc.Save(dname, saveParams, returnParams);
...
Any idea why this happens?
Thank you!!!
The tilde doesn't work for me either (FM11), but you can get the value of an environment variables with $.getenv():
var docLib = $.getenv("HOME") + "\\Checkout\\Test\\";
Copy link to clipboard
Copied
The tilde doesn't work for me either (FM11), but you can get the value of an environment variables with $.getenv():
var docLib = $.getenv("HOME") + "\\Checkout\\Test\\";
Copy link to clipboard
Copied
Hi JoH,
Thank you for your response and for the suggestion! It does work. I wonder why tilde doesn't.
BTW, why is the $ sign used before the getenv(" ") function?
Thanks!
Copy link to clipboard
Copied
Hi rombanks
BTW, why is the $ sign used before the getenv(" ") function?
have a look at:
Chapter 8, page 216, “Dollar ($) object” in the JavaScript Tools Guide
Copy link to clipboard
Copied
Hi Klaus,
Thank you for the pointer. I appreciate your help!