Determines the folder where BrainVoyager currently looks for files.
strCurrentFolder objBrainVoyager.GetCurrentFolder()
For methods requiring file names as input,
full path information should be provided. It is, however, more convenient
to specify file names without the full path information which allows also
to move folders to new locations without changing the content of moved
script files. If files are specified without absolute path information,
it should be known which folder is used as the current folder. The presented
method allows to obtain the path to the current folder. BrainVoyager's
current folder is also identical with the path to the running script file
but only when the script has been launched from within BrainVoyager. If
a script has been launched from outside of BrainVoyager, the current folder
is not necessarily the same as
the folder from which the script has been started since a freshly launched
BrainVoyager sets the current folder to the one which was active when
BrainVoyager was closed before.
If a script has been started from outside of BrainVoyager via the Windows
Script Host, BrainVoyager has no knowledge about the folder from where
the script has been started. In this case, however, the "WScript"
object is available which possesses methods to determine information about
the folder from which the script was started.
' VBScript - full
code in file "GetScriptPath.pl"
Set BrainVoyager = CreateObject("BrainVoyager.1")
If BrainVoyager.ScriptLaunchedByBV
Then
path_to_script = BrainVoyager.GetCurrentFolder
Else
ScriptName = WScript.ScriptFullName
path_to_script = Left(ScriptName,
InstrRev(ScriptName, "\"))
End If
// JScript - full
code in file "GetScriptPath.pl"
BrainVoyager = new ActiveXObject("BrainVoyager.1");
if(BrainVoyager.ScriptLaunchedByBV())
path_to_script = BrainVoyager.GetCurrentFolder();
else
{
ScriptName = WScript.ScriptFullName;
path_to_script = ScriptName.substr(0,
ScriptName.lastIndexOf("\\") + 1);
}
#
PerlScript - full code in file "GetScriptPath.pl"
use cwd; # special module allows to retrieve current working directory
$dir = getcwd;
# append "\" but not if root dir
if(length($dir) > 3)
{ $path_to_script = $dir . "\\"; }
else
{ $path_to_script = $dir; }