Hey, please take a look at this code and tell me why it does not want to save file. Script is giving me an error that I do not have access to file. Error suggest that I need to change the mail access to read and write. After I open mail app -> information, previously unlocking the lock, I cannot add access, cannot change it and Sonoma showing error that I cannot change setting since I do not have access.
Mail app has full disc access, as well as script editor and terminal.
set acc_name to "TEST"
set sender_email to "andrew"
set email_subject to "Test"
set download_folder to (POSIX file "location") as string
set python_script to "location2"
using terms from application "Mail"
tell application "Mail"
if not it is running then activate
repeat with aMessage in messages of mailbox "Alpha" of account acc_name
set client_sender to sender of aMessage
set client_subject to subject of aMessage
set client_attachment to name of mail attachment of aMessage as rich text
set attachment_file to mail attachment of aMessage
if client_sender is sender_email and client_subject is email_subject then
--set noti_text of subject of aMessage
display notification (client_sender & " " & client_attachment) as rich text with title client_subject
tell application "Finder"
delete (every item of folder download_folder)
end tell
--set attachmentPath to open for access download_folder & client_attachment with write permission
--close access attachmentPath
6
save attachment_file in download_folder
end if
end repeat
end tell
end using terms from
I am starting to think that it might be system error, not script issue.