Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Short, sweet, and flexible?' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Short, sweet, and flexible?
Authored by: DesignX on Apr 27, '05 04:27:53PM

Since I was looking to do this myself, I'm happy to see someone else has done all the work!
Here is a combination of all the (best? most elegant??) shortest! code and seemingly most flexible in these threads. (Who am I to say? I don't know my elbow from the teakettle with shell scripts and I write AppleScript like I speak Chinese.) But this works from anywhere to anywhere (flexible) and it is short.
A combination of obscure requirements in the Mail rule, a unique script name, and/or (probably better) encrypted e-mail would keep it secure.
It is a combination of code from xone, zendrew, and whoever's shoulders they're standing on.
Comments? Improvements?

Complete and ready to run:
[code]
using terms from application "Mail"
on perform mail action with messages theMessages for rule Name_of_your_mail_rule_here
set ip_address to (do shell script "curl -f http://checkip.dyndns.org | awk '{print substr($6,1,length($6)-15)}'")
tell application "Mail"
repeat with eachMessage in theMessages
set theSubject to subject of eachMessage
try
set replyMessage to reply eachMessage without opening window
set the subject of replyMessage to ip_address
send replyMessage
end try
end repeat
end tell
end perform mail action with messages
end using terms from
[/code]


---
DesignX



[ Reply to This | # ]