Objective
I want to grab the stem of the filename of the first file of I one or more files currently selected.
Default Script
I have butchered the default JS script as per below.
I run the script and get the output also shown below
Question01
How might I best get what I am after? I am getting the file and path currently. I only want the stem of the filename as highlighted with green in the output.
Many thanks as always
function OnClick(clickData)
{
// Selected files enumerator from the default JScript app
// --------------------------------------------------------
DOpus.ClearOutput();
// --------------------------------------------------------
var cmd = clickData.func.command;
cmd.deselect = false; // Prevent automatic deselection
// --------------------------------------------------------
cmd.RunCommand("Set VIEW=Details");
// --------------------------------------------------------
DOpus.Output("Selected items in " + clickData.func.sourcetab.path + ":");
if (clickData.func.sourcetab.selected.count == 0)
{
DOpus.Output(" (none)");
}
else
{
var eSel = new Enumerator(clickData.func.sourcetab.selected);
if (eSel.item().is_dir)
{
DOpus.Output(" (d) " + eSel.item().RealPath);
}
else
{
DOpus.Output(" (f) RealPath :" + eSel.item().RealPath);
DOpus.Output(" (h) item :" + eSel.item());
DOpus.Output(" (i) stem :" + eSel.item().stem);
}
}
// --------------------------------------------------------
// --------------------------------------------------------
// --------------------------------------------------------
}