Hi All,
I have a script being launched by a Mail rule.
Sample. (Suggested from post http://bbs.applescript.net/viewtopic.php?id=20575 not my actual script)
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
repeat with eachMessage in theMessages
tell application "Mail"
tell eachMessage
set theSender to (extract name from sender)
set theDate to date received
set theContents to content as text
end tell
end tell
set theDate to short date string of theDate
set TempFile to ((path to desktop) as string) & theSender & "_" & theDate
set theTextFile to open for access TempFile with write permission
write theContents to theTextFile
close access theTextFile
end repeat
end perform mail action with messages
end using terms from
I have added quite a bit of code to this script. My question is do I have to explicitly call an apps terms for tell blocks to other apps beside mail?
Example
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
repeat with eachMessage in theMessages
tell application "Mail"
tell eachMessage
set theSender to (extract name from sender)
set theDate to date received
set theContents to content as text
end tell
end tell
set theDate to short date string of theDate
set TempFile to ((path to desktop) as string) & theSender & "_" & theDate
set theTextFile to open for access TempFile with write permission
write theContents to theTextFile
close access theTextFile
end repeat
--ADDED TELL BLOCK
tell application "Whatever"
do stuff that involves terms only in it's dictionary
end tell
--OR SHOULD IT BE
using terms from application "Whatever"
tell application "Whatever"
do stuff that involves terms only in it's dictionary
end tell
end using terms from
end perform mail action with messages
end using terms from
Is this needed or does it access the terms of the app by default even when nested in a “using terms from” statment?
I have a stand alone version of my script for testing that works fine. When I put the code back in the actual script that Maill will use, which has the entire script in a Using terms from application “Mail” statment and a “on perform mail action” handler, some of the code no longer works.
Thanks,
Mark