pmazer
2005-12-07, 22:45
set txt to ""
set filename to POSIX path of (path to desktop) & "email.txt"
tell application "Mail"
check for new mail
repeat with msg in messages in inbox
if id in msg is not equal to id in first message in inbox then
set txt to txt & "
###
"
end if
set txt to txt & "From: " & (sender in msg) & "
Subject: " & (subject in msg) & "
" & (content in msg)
end repeat
end tell
tell application "TextEdit"
set textfile to (make new document at beginning with properties {text:txt})
save textfile in filename
end tell
I'm working on an Applescript to output email to a text file, but I'm encountering a problem. Whenever this is run, instead of saving it to the Desktop, it saves it to the root directory as the file ":Users:username:Desktop:email.txt" instead of the file "email.txt" in my desktop. How do I fix this? Thanks!
set filename to POSIX path of (path to desktop) & "email.txt"
tell application "Mail"
check for new mail
repeat with msg in messages in inbox
if id in msg is not equal to id in first message in inbox then
set txt to txt & "
###
"
end if
set txt to txt & "From: " & (sender in msg) & "
Subject: " & (subject in msg) & "
" & (content in msg)
end repeat
end tell
tell application "TextEdit"
set textfile to (make new document at beginning with properties {text:txt})
save textfile in filename
end tell
I'm working on an Applescript to output email to a text file, but I'm encountering a problem. Whenever this is run, instead of saving it to the Desktop, it saves it to the root directory as the file ":Users:username:Desktop:email.txt" instead of the file "email.txt" in my desktop. How do I fix this? Thanks!