如何在 AppleScript 中添加当前月份?
How to add the current month in AppleScript?
我有一个脚本可以用来自动化一个小的工作流程,但我无法让主题列出当前月份。
这是我的脚本:
tell application "Finder" to set selectedItem to item 1 of (get selection)
set theAttachment to selectedItem as alias
set fileName to name of selectedItem
tell application "Microsoft Outlook"
set newMessage to make new outgoing message with properties {subject:"(current month) as string Message from John Doe"}
tell newMessage
make new attachment with properties {file:theAttachment}
end tell
open newMessage
get newMessage
end tell
这可能吗?我试过在线搜索和在 Script Debugger 中搜索,但总是找不到。提前致谢。
我不使用 Microsoft Outlook,所以我假设您的脚本执行没有错误,但只是产生了一个不希望的结果,即一封新的外发电子邮件,其中包含 ”(当前month) as string Message from John Doe 在主题行中。
在此基础上,要让您的主题行仅包含当前月份,请在您的脚本中找到包含此内容的相关行:
{subject:"(current month) as string Message from John Doe"}
并用这个替换它
{subject:(current date)'s month as text}
如果您希望主题行在月份之后包含其他文本,就像您的原始脚本那样,那么您可以将其替换为:
{subject:((current date)'s month as text) & " Message from John Doe"}
我有一个脚本可以用来自动化一个小的工作流程,但我无法让主题列出当前月份。
这是我的脚本:
tell application "Finder" to set selectedItem to item 1 of (get selection)
set theAttachment to selectedItem as alias
set fileName to name of selectedItem
tell application "Microsoft Outlook"
set newMessage to make new outgoing message with properties {subject:"(current month) as string Message from John Doe"}
tell newMessage
make new attachment with properties {file:theAttachment}
end tell
open newMessage
get newMessage
end tell
这可能吗?我试过在线搜索和在 Script Debugger 中搜索,但总是找不到。提前致谢。
我不使用 Microsoft Outlook,所以我假设您的脚本执行没有错误,但只是产生了一个不希望的结果,即一封新的外发电子邮件,其中包含 ”(当前month) as string Message from John Doe 在主题行中。
在此基础上,要让您的主题行仅包含当前月份,请在您的脚本中找到包含此内容的相关行:
{subject:"(current month) as string Message from John Doe"}
并用这个替换它
{subject:(current date)'s month as text}
如果您希望主题行在月份之后包含其他文本,就像您的原始脚本那样,那么您可以将其替换为:
{subject:((current date)'s month as text) & " Message from John Doe"}