just wondering if you can help
I have set out to create Smart mailbox in Mail app using applescript The list of emails for smart inbox are in myFile.txt on desktop. Each line has one email
I want to the smart Inbox with several emails, and want to automate it
I have tried the following script
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
Gives me an error
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
Any help to resolve this error wud be appreciated Also to change in drop down from "Any Recipient" to "From" in the Script Cheers