के लिए मेल "जारी नहीं रख सकता" मेल मैं संदेशों के संदेश अनुलग्नकों को सहेजने के लिए मेल (हिम तेंदुए पर) के उपयोग के लिए एक ऐप्पलस्क्रिप्ट लिखने की कोशिश कर रहा हूं। AppleScript का मुख्य हिस्सा है:ऐप्पलस्क्रिप्ट फ़ंक्शन
error "Mail got an error: Can’t continue isImageFileName." number -1708
जहां त्रुटि -1708 है:
property ImageExtensionList : {"jpg", "jpeg"}
property PicturesFolder : path to pictures folder as text
property SaveFolderName : "Fetched"
property SaveFolder : PicturesFolder & SaveFolderName
tell application "Mail"
set theMessages to the selection
repeat with theMessage in theMessages
repeat with theAttachment in every mail attachment of theMessage
set attachmentFileName to theAttachment's name
if isImageFileName(attachmentFileName) then
set attachmentPathName to SaveFolder & attachmentFileName
save theAttachment in getNonexistantFile(attachmentPathName)
end if
end repeat
end repeat
end tell
on isImageFileName(theFileName)
set dot to offset of "." in theFileName
if dot > 0 then
set theExtension to text (dot + 1) thru -1 of theFileName
return theExtension is in ImageExtensionList
end if
return false
end isImageFileName
जब चलाने के लिए, मैं त्रुटि मिलती है
Event wasnt handled by an Apple event handler.
हालांकि, अगर मैं कॉपी/पेस्ट
property ImageExtensionList : {"jpg", "jpeg"}
on isImageFileName(theFileName)
set dot to offset of "." in theFileName
if dot > 0 then
set theExtension to text (dot + 1) thru -1 of theFileName
return theExtension is in ImageExtensionList
end if
return false
end isImageFileName
if isImageFileName("foo.jpg") then
return true
else
return false
end if
: की तरह एक और स्क्रिप्ट में
यह ठीक काम करता है। मेल इस बारे में शिकायत क्यों करता है?
दूसरे शब्दों में यह एक नामस्थान और दायरा मुद्दा है। अति उत्कृष्ट। –
मुझे उम्मीद है कि मैं कुछ समय पर एप्पलस्क्रिप्ट सीख रहा हूं, ऐसी चीजें असमान समय लेने से बाहर निकल जाएंगी :) इस बिंदु पर ऐसा लगता है कि मुझे अन्य भाषाओं की तुलनीय कार्यक्षमता के लिए एएस में कई और पंक्तियां लिखनी हैं। –