D
David Smith
I really don't know if this is more an entourage question or an applescript
question, but I'm having difficulty with what I thought would be a simple
scripting project. I receive emails that I would like to create a rule for
that would run an applescript that would copy the text of the message to a
plain text file on my local hard drive. From there another shell script will
pick it up and go from there, but the data has to be in plain text. Right
now I have the following script:
-----------------------------------------------
tell application "Microsoft Entourage"
set theMsgs to (current messages)
repeat with theMsg in theMsgs
set this_data to theMsg's {content}
end repeat
end tell
try
set this_file to ((("Macintosh HD:Users:gVeloperesktop:") as text) &
"MessageText")
my write_to_file(this_data, this_file, false)
on error error_message number error_number
set this_error to "Error: " & error_number & ". " & ¬
error_message & return
set the log_file to (("Macintosh HD:Users:gVeloperesktop:") as text) &
"Script Error Log"
my write_to_file(this_error, log_file, true)
end try
on write_to_file(this_data, target_file, append_data)
try
set the target_file to the target_file as text
set the open_target_file to ¬
open for access file target_file with write permission
if append_data is false then ¬
set eof of the open_target_file to 0
write this_data to the open_target_file starting at eof
close access the open_target_file
return true
on error
try
close access file target_file
end try
return false
end try
end write_to_file
-----------------------------------------------
The problem is that the resulting file is not in plain text, but something I
cannot edit in vi and can't use my unix utilities to manipulate. I've gone
through entourage's dictionary and it seems like the "content" property is
what I want, but how can I write it to plain text?
Thanks in advance,
--
Dave
(e-mail address removed) (e-mail address removed)
http://homepage.mac.com/gveloper/
http://ncisnet.net
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GAT d? s+ a-- C++++ ULIS++++ P+ L+++ E- W+++ N+ o K- w--- O M++ V-- PS-- PE
Y+ PGP++ t+ 5 X+++ R tv++ b- DI++++ D+ G++ e h-- !r y-
------END GEEK CODE BLOCK------
question, but I'm having difficulty with what I thought would be a simple
scripting project. I receive emails that I would like to create a rule for
that would run an applescript that would copy the text of the message to a
plain text file on my local hard drive. From there another shell script will
pick it up and go from there, but the data has to be in plain text. Right
now I have the following script:
-----------------------------------------------
tell application "Microsoft Entourage"
set theMsgs to (current messages)
repeat with theMsg in theMsgs
set this_data to theMsg's {content}
end repeat
end tell
try
set this_file to ((("Macintosh HD:Users:gVeloperesktop:") as text) &
"MessageText")
my write_to_file(this_data, this_file, false)
on error error_message number error_number
set this_error to "Error: " & error_number & ". " & ¬
error_message & return
set the log_file to (("Macintosh HD:Users:gVeloperesktop:") as text) &
"Script Error Log"
my write_to_file(this_error, log_file, true)
end try
on write_to_file(this_data, target_file, append_data)
try
set the target_file to the target_file as text
set the open_target_file to ¬
open for access file target_file with write permission
if append_data is false then ¬
set eof of the open_target_file to 0
write this_data to the open_target_file starting at eof
close access the open_target_file
return true
on error
try
close access file target_file
end try
return false
end try
end write_to_file
-----------------------------------------------
The problem is that the resulting file is not in plain text, but something I
cannot edit in vi and can't use my unix utilities to manipulate. I've gone
through entourage's dictionary and it seems like the "content" property is
what I want, but how can I write it to plain text?
Thanks in advance,
--
Dave
(e-mail address removed) (e-mail address removed)
http://homepage.mac.com/gveloper/
http://ncisnet.net
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GAT d? s+ a-- C++++ ULIS++++ P+ L+++ E- W+++ N+ o K- w--- O M++ V-- PS-- PE
Y+ PGP++ t+ 5 X+++ R tv++ b- DI++++ D+ G++ e h-- !r y-
------END GEEK CODE BLOCK------