【发布时间】:2021-01-29 16:19:24
【问题描述】:
我使用名为 PDF Lightweight 的应用程序来压缩我的 PDF(因为我的体验非常好),并使用 Thunderbird 来发送电子邮件。
我想编写一个 AppleScript,在将 PDF 附加到电子邮件之前对其进行压缩:
set attachment1 to "/Users/username/Desktop/Test.pdf"
do shell script "open -a " & quoted form of ("/Applications/Lightweight PDF.app") & " " & quoted form of attachment1
set email_attachment to "attachment=" & "'file://" & attachment1 & "'"
set thunderbird_bin to "/Applications/Thunderbird.app/Contents/MacOS/thunderbird-bin -compose "
set arguments to email_attachment
do shell script thunderbird_bin & quoted form of arguments & ">/dev/null 2>&1 &"
问题是原始 PDF 将在压缩完成之前附加。我尝试使用this 之类的东西,但它也不起作用。我想是因为我使用“打开”命令启动 PDF Lightweight,即使应用程序仍在压缩,该命令在技术上也是完整的。
知道如何让脚本等待 PDF 压缩吗?
谢谢!
【问题讨论】:
标签: terminal applescript