I'm trying to create a button that executes a command like idea64.exe {filepath}
if any folder is selected or idea64.exe {currentpath}
if no items are selected.
I tried to use @if
but couldn't figure this one out.
I'm trying to create a button that executes a command like idea64.exe {filepath}
if any folder is selected or idea64.exe {currentpath}
if no items are selected.
I tried to use @if
but couldn't figure this one out.
If you don't care about Flat View and Collections (Find Results etc.), you can use this:
@dirsonly
idea64.exe {sourcepath$}{file}
To make it work better in more situations, use scripting:
function OnClick(clickData)
{
var cmd = clickData.func.command;
var tab = clickData.func.sourcetab;
// Is exactly one directory selected?
if (tab.selected_dirs.count == 1
&& tab.selected.count == 1)
{
cmd.RunCommand("idea64.exe {filepath$}");
}
else
{
cmd.RunCommand("idea64.exe {sourcepath$}");
}
}