Weird, I wrote and thought I posted a script for this yesterday but it looks like I didn't post it.
/p1 looks like the email subject parameter from the SwithMail docs, so I think {file$} is expected to be the name of the first file.
I think this small change to tbone's script makes it do what you want with the /p1 {file$} part, although I have not tested it:
Script Type: JScript
[code]function OnClick(data){
var f=data.func, cmd=f.command, tab=f.sourcetab, sfiles=tab.selected_files, atts="";
for(var i=0;i<tab.selected_files.count;i++)
atts+=sfiles(i).realpath+(i+1<sfiles.count?"|":"");
cmd.RunCommand('D:\Utilities\SwithMail\SwithMail.exe '+
'/s /x "D:\Utilities\SwithMail\smset.xml" /p1 "' +
sfiles(i).name +
'" /a "'+atts+'"');
}[/code]
Here's the script I wrote yesterday, which I tested and which also does the /p1 {file$} part:
Script Type: JScript
[code]function OnClick(clickData)
{
if (clickData.func.sourcetab.selected.count > 0)
{
var cmd = clickData.func.command;
cmd.ClearFiles();
cmd.deselect = false; // Prevent automatic deselection
var firstFileName = "";
var fileList = "";
for (var eSel = new Enumerator(clickData.func.sourcetab.selected); !eSel.atEnd(); eSel.moveNext())
{
if (!eSel.item().is_dir)
{
if (fileList.length > 0)
fileList += "|";
else
firstFileName = eSel.item().Name
fileList += eSel.item().RealPath;
}
}
var cmdLine = '"D:\\Utilities\\SwithMail\\SwithMail.exe" /s /x "D:\\Utilities\\SwithMail\\smset.xml" /p1 "' + firstFileName + '" /a "' + fileList + '"';
//DOpus.Output(cmdLine);
cmd.RunCommand(cmdLine);
}
}[/code]