Question related to eMail attachments

The function plugins.mail.createBinaryAttachment provides two arguments: what to name the file being attached and the path to the file to be processed.

Is there a simple way to identify (parse out) the name of the file the user selected? Yes, I can (and have) built a complex routine using the Utilities functions, but I sense there is probably something simpler available.

Kind regards,

out of my head: there should be a file plugin function called getParent() or something like that. So if you have

var file = plugins...showFileSelectDialog() // gives you for example "C:\Test.txt"

getParent() should give you

var parent = file.getParent() // gives you "C:\"

with that you can simply replace parent in file which leaves “Test.txt”.

Hi Morley,

There are also some items in this thread which discuss getParent() and other options too:

Cheers
Harry

Thanks Harry and Patrick. Turns out it’s as simple as this:

var vAttachPath = plugins.file.showFileOpenDialog();
var vFilename = vAttachPath.getName();

Here’s hoping the docs for the File plug-in get amplified.

Kind regards,