I'm trying to work on an evaluator block to conditionally set file names, something like:
@set testVar={=
pathNoExt=Parent(selpath) + Stem(selpath);
if(IsFile(pathNoExt + ".md"))
{Output(pathNoExt + "-2.md")}
else
{Output(pathNoExt + ".md")}
=}
(I just use the Output function so it outputs to the script log, i'll actually set a variable or whatever when i get it working)
But the trouble is that it's appending a terminator at the end of the stem, I guess because it thinks its the end of the path, and the ".md" is just a string:
7/18/2025 11:42:47.546 AM Evaluator: C:\Users\Joe\Working\Temp\Test\.md
And of course it's doing it within the if condition so this is never ending up true:
if(IsFile(pathNoExt + ".md"))
I tried using Val like:
Output(Val(pathNoExt));
But that still seems to return a path type too. Is there a way in evalator to just get the raw string?
Or maybe it's thinking it's a folder path, so is there something I'm meant to do to tell it to treat it like a file path?
Also strangely, this does seem to work when using the filePath variable:
@set testVar={=if(IsFile(filePath + ".md")){Output(filePath + "-2.md")}else{Output(filePath + ".md")}=}
It doesn't append the terminator, though I didn't use the stem or anything so it just slaps it on the end of the previous extension, but the behavior is notable:
7/18/2025 11:52:37.192 AM Evaluator: C:\Users\Joe\Working\Temp\Test.txt-2.md