On 2010-09-23 15:44 , Rudolf O. Durrer wrote:
Thanks your anser, steve, but I have to admit: I did not understand
that. How does Applescript read the file line by line in the Finder?
What I'm looking for is an applescript, which I can trigger (by means of
a Quickeys shortcut).
you asked to know a _method_, as if you were prepared to write the
script, but it sounds like you actually want an already-written script,
which is a bigger request; here's a crude script that returns the
subject -- can you take it from there?
(if a line starts in the first column it continues the previous line)
on get_emlx_subject(a_file)
set the_result to ""
-- maybe needs localization
if kind of (info for a_file) is "Mail Message" then
set the_handle to open for access a_file
set line_end to ASCII character 10
set the_text to read the_handle using delimiter line_end
repeat with a_line in the_text
if a_line begins with "Subject:" then
set the_result to (characters 10 through end of a_line) as
Unicode text
exit repeat
end if
end repeat
end if
close access the_handle
return the_result
end get_emlx_subject
set a_file to choose file
get_emlx_subject(a_file)
_______________________________________________
MacOSX-talk mailing list
[email protected]
http://www.omnigroup.com/mailman/listinfo/macosx-talk