• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Applescript count mail attachment error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Applescript count mail attachment error


  • Subject: Re: Applescript count mail attachment error
  • From: Brian Christmas <email@hidden>
  • Date: Sat, 05 Mar 2016 06:05:12 +1100

G’day from the land of Oz, Fred.

This code works for me in Yosemite & El Capitan

tell application "Mail"
set my currentMailItem to last message of mailbox "* items to re-cycle"
  if (count of (mail attachments of (my currentMailItem))) is 0 and (my currentMailItem) ≠ {} then my playGlass()


Regards

Santa

On 4 Mar 2016, at 1:51 AM, Fred Diepeveen <email@hidden> wrote:

Hi, I need some help.
I have a script processing mail with of without an attachment (jpg, png)
It worked well but now on Yosemite there is a problem:

Mail kreeg een fout: AppleEvent-handler mislukt. (Mail error: AppleEvent-handler failed)

Resultaat:

error "Mail kreeg een fout: AppleEvent-handler mislukt." number -10000

There is an attachment. The count gives an error. See underline

The script is like this

set walletmobileAccount to "demomycardwallet"

tell application "Mail"

set attachmentsFolder to "Volumes:Macintosh HD:Users:did4you:Downloads:" as rich text

set thereIsFoto to false
set fileCounter to 1
set logoFile to ""
set pictureFile to ""
-- display dialog "attachmentsFolder = " & attachmentsFolder
set theMessage to message 2 of mailbox "INBOX" of account walletmobileAccount


if (count of (theMessage's mail attachments)) > 0 then

repeat with theAttachments in theMessage's mail attachments
set originalName to name of the theAttachments
-- display dialog "Naam van attachment = " & originalName
set foto to originalName
if fileCounter = 1 then
set logoFile to originalName
end if
if fileCounter = 2 then
set pictureFile to originalName
end if
set savePath to attachmentsFolder & originalName
save theAttachments in savePath
do shell script "cp -f -R Users/did4you/Downloads/" & quoted form of originalName & " Users/did4you/Documents/MaakZP/Bijlagen/"
do shell script "rm -R Users/did4you/Downloads/" & quoted form of originalName
set fileCounter to fileCounter + 1

end repeat

-- display dialog "Foto : " & logoFile
-- display dialog "pictureFile : " & pictureFile
set thereIsFoto to true

end if -- are there any attachments
end tell


Mvgr.

Fred Diepeveen
email@hidden
+31 652002500



And what, you ask, was the beginning of it all?
And it is this......
Existence that multiplied itself
For sheer delight of being
And plunged with numberless trillions of forms
So that it might
find
itself
innumerably

Sri Aurobindo



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Applescript count mail attachment error (From: Fred Diepeveen <email@hidden>)

  • Prev by Date: Re: increment a variable
  • Next by Date: Re: Applescript count mail attachment error
  • Previous by thread: Applescript count mail attachment error
  • Next by thread: Re: Applescript count mail attachment error
  • Index(es):
    • Date
    • Thread