Goal: Basically my goal is to have an option appear in the right click context menu only when right clicking a symbolic link folder. Or at least a toolbar button that does the same.
My current approach has been to try and start with this evaluator logic to simply check if the resolved path of the selected file is the same as the regular unresolved path.
(I can't remember if filepath$
or filepath
is the proper way to reference it in an evaluator but both seem to work):
@Output Resolved Path Is Same: {=Resolve(filepath$,"js")==filepath$=}
@Output Resolved Path Is Same: {=Resolve(filepath,"js")==filepath=}
And that logic does work, outputting true for regular files/folders, and false for shortcuts/symbolic links. At least when running it via clicking the button or hitting "Run" in the command editor.
Problem:
However I've been struggling to get it to work with @showif / @hideif. No matter what I try, it always seems to show an error in the log about filepath
being an unknown value.
For example, if this is applied to a toolbar button:
@hideif:=Resolve(filepath,"js")==filepath
Then when the command editor is closed so Directory Opus is just in the usual usage context, the logs show:
11/4/2024 9:06 AM Evaluator: Error at line 1, position 9
Unknown value (6): filepath
Resolve(filepath,"js")==filepath
Same if using filepath$
, though again not sure the difference:
@hideif:=Resolve(filepath$,"js")==filepath$
Unknown value (6): filepath$
Other Stuff I Tried:
I was able to have some success testing @showif / @hideif so that it only shows the button if a single folder is selected like this:
@showif:=((FileCount(true,"dirs:*") == 1) && (FileCount(true,"files:*") == 0))
However I guess FileCount()
only applies to the file name and not the entire path so it wouldn't apply to my case.
I thought maybe I could assign filepath to a variable first like this as a test:
@evalalways:{currPath = filepath}
@hideif:=Resolve(currPath,"js")==currPath
But that ends up just saying currPath is unknown:
11/4/2024 9:33 AM Evaluator: Error at line 1, position 9
Unknown value (6): currPath
Resolve(currPath,"js")==currPath
And even if I just have it try to output the currPath evaluator variable when running it as a button press:
@Output {=currPath=}
It just outputs the evaluator preparse dummy file path:
C:\Evaluator-Preparse-Dummy-Filename.txt
Other approaches:
Since I already have a filter set in the preferences for identifying symlinks (which I use to color them in the lister) I was trying to figure out if it was possible to use filters with the evaluator somehow, but couldn't figure it out. If that's possible though I could start a separate thread that focuses on that question.