<scriptpath> variable that can be used in .xys files.We can get the path of the current script using
self('path'), but this feels like something there should be a native variable for.In my case, I have a
.ini configuration file that might contain <variable> placeholders, so I'm using eval() to resolve these strings into their actual values...Code: Select all
[ProgramPaths]
jq=<scriptpath>\resources\programs\jq\jq.exe
mediaInfoCLI=<xyparent>\Command\programs\mediainfo\MediaInfo.exe
movieThumbnailer=<xyparent>\MovieThumbnailer\mtn.exe
Code: Select all
if ( $variable LikeI '<scriptpath>' ) {
// This variable should be replaced with the path of the current script
$value= replace($value, "$variable", self('path'));
} else {
// This is a native XY variable and should be resolved
$value= replace($value, "$variable", eval("$variable"));
}
<scriptname>. Both these variables are very handy for constructing relative paths when writing portable XYScripts.
XYplorer Beta Club