특정 이메일 주소로 많은 vCard를 수신합니다. vcards를 메일 규칙과 AppleScript를 통해 내 연락처에 자동으로 추가하려고합니다.메일 규칙 및 AppleScript로 연락처에 vcard 추가
나는 많은 것을 수색하고 무언가를 발견했다. 나는 그것을 약간 수정했다. 그리고 개장과 추가 과정이 잘 작동합니다. 하지만 파일을 선택할 때만. 파일을 메일 메시지에서 변수로 가져올 수 없습니다. 나는 그것을 시도했지만 작동하지 않습니다. I 라인 1, 2, 3을 삭제 한 다음 그것을 작동합니다 "thefile 파일을 선택하도록 설정"4 번 작성하는 경우
tell application "Mail"
set att to attachment
end tell
set thefile to att
tell application "Contacts"
activate
open thefile
end tell
tell application "System Events" to keystroke return
- 나는 파일을 선택하는 경우 :
여기에 지금까지 내 코드입니다. 그러나 처음 세 줄은 어떤 것을 시도했지만 성공하지 못했습니다. 제 질문은 메시지에서 파일을 가져 오는 방법입니다. 는너의 진심 크리스 감사
해결 방법 : 이메일에서 첨부
set Dest to ((path to desktop folder) as string)
tell application "Finder" to make new folder in Dest with properties {name:"TempFiles"} -- create TempFiles folder
Set Dest to Dest & "TempFiles:"
tell application "Mail"
activate -- not sure is mandatory, but I prefer to see selected mails !!
set ListMessage to selection -- get all selected messages
repeat with aMessage in ListMessage -- loop through each message selected
set AList to every mail attachment of aMessage -- get all attachements
repeat with aFile in AList -- for each attachement
if (downloaded of aFile) then
set Filepath to Dest & (name of aFile)
do shell script "touch " & (quoted form of (POSIX path of Filepath)) -- required because "Save" only works with existing file !
save aFile in (Filepath as alias) as native format
end if
end repeat -- next file
end repeat -- next message
end tell
tell application "Finder" to set CardList to every file of folder Dest whose name extension is {"vcf"}
tell application "Contacts"
activate
repeat with aCard in CardList
open aCard
delay 1
tell application "System Events" to keystroke return
end repeat
end tell
delay 2
-- tell application "Finder" to delete folder Dest
감사합니다 - 스크립트가 저에게 효과적입니다. 하지만 난 텔 응용 프로그램 "연락처" 이 개방 thefile 끝이 부품을 반환 키 입력하려면 "시스템 이벤트"를 TELL 응용 프로그램을 말해 활성화를 배치해야합니까? 대본이 끝나거나 끝나면? 아무것도 작동하지 않지만 독립 실행 형 스크립트는 완벽하게 작동합니다. –
방금 "vCard 열기"및 최대 임시 폴더 삭제를 포함한 전체 스크립트로 내 스크립트를 업데이트합니다. – pbell
고맙습니다.하지만 TempFiles 폴더에서는 작동하지 않습니다. 모든 파일을 바탕 화면 폴더에 있지만 하위 폴더에는 다운로드 할 수 없습니다 ... 그리고 시스템 이벤트 키 스트로크는 더 이상 작동하지 않습니다 ... 어쩌면 내가 직접 고칠 수 있습니다 ... 시도 했습니까? 컴퓨터에 있나요? –