email - AppleScript:在邮件应用程序中从列表中创建 SmartInbox
问题描述
只是想知道你能不能帮忙
我已经开始使用 applescript 在邮件应用程序中创建智能邮箱智能收件箱的电子邮件列表位于桌面上的 myFile.txt 中。每行有一封电子邮件
我想要包含几封电子邮件的智能收件箱,并希望将其自动化
我尝试了以下脚本
tell application "Mail"
activate
end tell
# GUI Script to initiate Smart Inbox creation
tell application "System Events"
tell process "Mail"
tell menu bar 1
tell menu bar item "Mailbox"
tell menu "Mailbox"
click menu item "New Smart Mailbox…"
end tell
end tell
end tell
delay 1
# Set name for the Smart Mailbox
tell application "System Events" to keystroke ("MyAutomaticSmartMailBox" as text)
keystroke tab
# Set path to myFile.txt
set srcFile to ((path to desktop) as text) & "myFile.txt"
# Read lines from file.
set lns to paragraphs of (read file srcFile as «class utf8»)
# Loop over lines read and copy each to the clipboard.
repeat with ln in lns
set the clipboard to ln
# Paste the clipboard into Smart inBox dialog
tell application "System Events" to keystroke (the clipboard as text)
# to create next line to add email
click button "NSButtonCell"
end repeat
end tell
end tell
给我一个错误
error "System Events got an error: Can’t make file \"MackintoshHD:Users:one:Desktop:myFile.txt\" of process \"Mail\" into type file." number -1700 from file "MackintoshHD:Users:one:Desktop:myFile.txt" of process "Mail" to file
解决此错误的任何帮助都将不胜感激 还要在脚本欢呼中将下拉菜单从“任何收件人”更改为“发件人”
解决方案
`set theFile to ((path to desktop as text) & "test.txt")
将 theData 设置为 (read file theFile)` 的段落这 shud 读取文件,将其设置为 List,然后在 List 设置规则中使用 aData 重复,告诉规则“a”在结尾处创建带有条件的新规则.....
这工作:)
推荐阅读
- ibm-cloud-infrastructure - 如何获取在softlayer上订购的所有磁盘的列表
- node.js - 在javascript中获取发送到服务器端的客户端用户名
- django - 打开新网址时传递身份验证标头
- javascript - 如何将对象插入/添加到对象数组?
- html - HTML代码和markdown代码结合的问题
- intellij-idea - 在 Intellij 的 KotlinJS 中使用 pow
- spring-boot - 在 Spring Boot Gradle v2.1.2.RELEASE 中创建多个工件
- sql - 查询根据 PARALLEL 提示返回不同的结果
- java - Android:使用 RxJava 的 API 调用返回空响应
- matlab - 大矩阵中的空单元格问题:MATLAB