Index > Scribe > Saving attachments | |
---|---|
Author/Date | Saving attachments |
Scott 22/03/2021 10:26am | I'm attempting to write a script to save all attachments in a message folder to a file folder. Two questions:
- How to I prompt the user for a file folder? - How do a save an attachment to a file? |
fret 23/03/2021 7:37am | How to I prompt the user for a file folder? You have 2 options... - Use the SelectFile function to open a file select dialog. Ideally this would be a folder selector but I don't think there is any way to do that from script at the moment. - Or maybe use GetInputDlg if you just want the user to enter a string. How do a save an attachment to a file? If you're iterating over the Mail.Attachment collection, which are objects of type 'Attachment', there is a Save method on that object which you can pass a filename. Something like: for (i=0; i<Mail.Attachments; i++) { Mail.Attachment[i].Save(BasePath + "\\" + Mail.Attachment[i].Name); } |
fret 23/03/2021 7:47am | I've added a script function 'SelectFolder' that would be more suited to your script. And also the SelectFiles function has a new optional parameter to switch it to a "save as" dialog. |
Scott 23/03/2021 12:59pm | SelectFolder sounds good -- thanks.
I'm thinking that the Tools menu is the best place for this, but I'm struggling with the first parameter to AddToolsMenuItem and the LoadString() function. What should I be using for this first parameter. |
Scott 04/04/2021 4:26am | I had the script in the wrong folder, after fixing, the functionality appears in the Tools menu. |
Reply | |