`@ifsel` doesn't work with `clickData.func.command`

  • Create a JScript toolbar button with this code and run it:
    function OnClick(clickData) {
        var cmd = clickData.func.command;
    
        cmd.AddLine("@ifsel");
        cmd.AddLine("@output:Selection available");
        cmd.AddLine("@ifsel:else");
        cmd.AddLine("@output:Selection NOT available");
    
        cmd.Run();
    }
    
    • Bug: It always prints "Selection available", even if nothing is selected.
  • Change the button's code to this and run it:
    function OnClick(clickData) {
        var cmd = DOpus.Create().Command();
        cmd.SetSourceTab(clickData.func.command.sourcetab);
    
        cmd.AddLine("@ifsel");
        cmd.AddLine("@output:Selection available");
        cmd.AddLine("@ifsel:else");
        cmd.AddLine("@output:Selection NOT available");
    
        cmd.Run();
    }
    
    • Now, what's printed is always correct (even in a folder like Recycle Bin).

Fixed in the next beta.

2 Likes