Create an elm file for new Outlook email
I want to export an email template (.elm file) for Microsoft Outlook every time I compose a new email using Apple Script in InDesign script. I use the script as below, but it does not work 😞
var script = [
'tell application "Microsoft Outlook"',
"set theMessage to the first message in drafts",
"tell me to saveMsg(theMessage)",
"end tell",
"to saveMsg(theMsg)",
'set folderPath to ("Users:userName:Downloads:")',
'if (do shell script "/bin/test -e " & quoted form of (POSIX path of folderPath) & " ; echo $?") is "1" then',
'do shell script "/bin/mkdir -p " & quoted form of (POSIX path of folderPath)',
"end if",
'set timeStamp to do shell script "date +%Y%m%d%H%M%S"',
'set emailSubject to "Test"',
'set fileName to emailSubject & "_" & timeStamp',
'set savePath to folderPath & fileName & ".eml" as string',
"save theMsg in file (savePath)",
"end saveMsg",
].join("\r");
app.doScript(
script,
ScriptLanguage.APPLESCRIPT_LANGUAGE,
undefined,
UndoModes.ENTIRE_SCRIPT,
undefined
)Does any expert help me? I got stuck in it for around 3 hours :(((
Thank you in advance!
