Script Editor / Scripting Question

Since I have some down time and cannot use V2018 due to splash screen not working, decided to brush up on scripting.

In general demo and upload.php there is script associated like:

// Used by upload.php    
procedure OpenImage(Path: String);        
S: String;
 // a) Get the path to the folder where to save the file.
 S := GetGlobalVar("HEPubStorageLocation", "");
 if S = "" then exit;
 // b) Append the filename as defined in upload.php
 S := IncludeTrailingBackslash(S) +Path;
 // c) Launch the default editor 
 OpenFile(S, "", SW_SHOWNORMAL); 

My question is how to replace line S := GetGlobalVar("HEPubStorageLocation", ""); so using the following:

getenv("HOMEDRIVE") . getenv("HOMEPATH"). "\\Documents\\My EXEOut Demo\\";

My tries end up with script errors.

Need to upload to users my documents folder (already modified upload.php and works fine). Now I need to echo location back using the UserMain script.

Thanks in advance.

In HEScript, you have to use the GetSpecialFolderPath function. As shown here:

For the My Documents folder, you would use:
S := GetSpecialFolderPath(5);
instead of
S := GetGlobalVar("HEPubStorageLocation", "");


I had tried that but used wrong folder number.