The test button code is as follows, add it to the 'All Files' context menu and select 'Evaluator Function' function type.
This button works well in the toolbar.
@showif:= all_txt = FileCount("*.txt");selected_txt = FileCount(true,"*.txt");Output(Format("all_txt: %1 selected_txt: %2",all_txt,selected_txt)); return true;
Output("-------------------");
Output("all txt:" + FileCount("*.txt"));
Output("selected txt: " + FileCount(true,"*.txt"));
In @showif, if no txt files are selected, FileCount(true,"*.txt") returns the total number of txt files. If the selected files include txt files, it returns the correct result. FileCount("*.txt") is always correct.
In the main evaluator code, FileCount(true,"*.txt") is always correct, while FileCount("*.txt") is always equal to the former.
Note that I originally wanted to use @showif:=selfiles>0 && FileCount(true,"*.jxl") == selfiles) to display the button when all selected files are jxl. I know I can set the button only for jxl file type, but I want to place it in the "Convert Image" submenu of 'Images' file type.
Directory Opus 13.20.3 (Beta) Build 9411 x64
OS 10.0 (B:26100 P:2 T:1) SP 0.0