2013-11-21 1 views
0

새 파일이 폴더에 추가되고 작동하는 경우 (일종의) 메시지를 통해 문자 메시지를 보내는 폴더 작업이 있습니다. 여기에 있습니다 :"메시지"텍스트에 대한 AppleScript 폴더 작업, 비틀기 필요

on adding folder items to this_folder after receiving added_items 
    set added_Items_List to {} 
    set dateString to (current date) as string 
    set theBody to "New items have been added to " & name of (info for this_folder) & ": " 

    tell application "Messages" 
     set theBuddy to buddy "E:[email protected]" of service "E:[email protected]" 
     send theBody & dateString to theBuddy 
    end tell 

end adding folder items to 

200 개의 파일이 추가되면 200 개의 텍스트가 전송됩니다.

나는 첫 번째 파일을 추가 할 때 메시지를 보내고 30 분과 같이 주어진 간격 동안 더 이상 무시하고 싶습니다. 이것이 가능한가?

또한 폴더 경로를 얻으려면 적어도 하나의 폴더가 있어야합니다.

고맙습니다.

답변

0

임시 파일을 사용해보십시오. POSIX path of this_folder으로 폴더의 전체 경로를 얻을 수 있습니다.

on adding folder items to this_folder after receiving added_items 
    do shell script "f=${TMPDIR}messagesfolderaction;[[ ! -e $f || $(stat -f%m $f) -le $(date +%s)-1800 ]]&&touch $f||echo a" 
    if result is not "" then return 
    set body to "New items have been added to " & POSIX path of this_folder & (current date) as text 
    tell application "Messages" 
     send body to buddy "E:[email protected]" of service "E:[email protected]" 
    end tell 
end adding folder items to 
+0

음 ... 주소에 도메인 이름을 수정하는 것 외에 필요한 작업이 있습니까? 내가 이것을 가능하게 할 때 아무 일도 일어나지 않는 것 같다. 감사! – scottl31

+0

@ scottl31 스크립트에 오류가 있었지만 편집했습니다. – user495470

+0

정말 좋은! 하나의 파일을 추가하고 메시지를받은 다음 여러 파일과 메시지가 없습니다. 큰! 이제 30 분 후에 더 추가하기를 기다리고 있습니다. 한 가지 질문 : 두 명 이상의 사람에게 보내려는 경우 주소를 적절하게 변경하고 "친구를 본문으로 보내기 ..."행만 복사하면됩니까? – scottl31