Mail (Snow Leopard)과 함께 사용하기 위해 AppleScript를 작성하여 이미지 첨부 파일을 폴더에 저장하려고합니다. AppleScript로의 주요 부분이다 : 나는 복사/붙여 넣기하면, 그러나Mail AppleScript 함수에 대해 "Can not continue"를 사용합니다.
Event wasnt handled by an Apple event handler.
: 오류 -1708가
error "Mail got an error: Can’t continue isImageFileName." number -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
, 나는 오류 다른 스크립트로 isImageFileName()
같은 :
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
잘 작동합니다. 왜 Mail은이 문제에 대해 불평합니까?
즉, 네임 스페이스 및 범위 문제입니다. 우수한. –
내가 applescript를 배우는 것을 계속하는 것에 따라 나는 어떤 점에서 희망을 품는다, 그런 물건은 과량의 시간을 잡는 것을 그만 둘 것이다 : 내가 다른 언어의 필적하는 기능을 위해 더 많은 선을 더 많이 쓸 필요가있는이 점에서 그것은 느낀다. –