Re: Controlling a Mac via email
Re: Controlling a Mac via email
- Subject: Re: Controlling a Mac via email
- From: Andy Satori <email@hidden>
- Date: Thu, 17 Mar 2005 08:21:00 -0500
An AppleScript that launches you Cocoa app would do the trick. Below is an
example, it's what I use harvest my MyPoints emails for my freebie points,
that I then spend on Barnes & Noble gift cards :-) (which I then spend on
programming and tech books, go figure!)
Andy
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
tell application "Mail"
repeat with eachMessage in theMessages
-- grab the message and parse the body for the link to be
loaded, viewed and closed.
set theContent to source of eachMessage
set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to "
"
set theLines to text items of theContent
set theLine to ""
set AppleScript's text item delimiters to oldDelims
repeat with aLine in theLines
if aLine contains "ALT=\"showme\"" then
set theLine to aLine
end if
end repeat
-- parse the link from the line
set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to "><"
set theElements to text items of theLine
set theLink to ""
set AppleScript's text item delimiters to oldDelims
repeat with anElement in theElements
if anElement contains "HREF=" then
set theLink to anElement
end if
end repeat
set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to "\""
set theElements to text items of theLink
set theLink to item 2 in theElements
set AppleScript's text item delimiters to oldDelims
-- open in OmniWeb
tell application "OmniWeb"
OpenURL theLink
end tell
-- open in safari
--tell application "Safari"
-- set theDocument to make new document
-- set URL of theDocument to theLink
--end tell
end repeat
end tell
end perform mail action with messages
end using terms from
On 3/17/05 5:23 AM, "Oliver Donald" <email@hidden> pounded the
keyboard to produce:
> Hello List,
>
> At work I spend a lot of time (at lunch hour, of course ;) on music boards
> where mixes are posted, typically 80+ megs in size, and I want to be able to
> download them to keep, but obviously I don't want to clog up work's
> bandwidth. So I had the idea of an app that would run at home, and I could
> 'talk' to it from work when I found a file to download, so when I got home,
> it would be there on my desktop.
>
> Cocoa would make such an app easy, but unfortunately I use only Windows at
> work, so a client/server setup would be very hard to develop. I also don't
> want to have to open ports and SSH or turn on Apache to do it with forms or
> anything like that. So, the best method I could think of was e-mail. It
> would be lovely if I could email myself at home with, say, a subject of
> 'Download' and the body would be the URL, and then it could email me back at
> work saying 'recieved request' and 'download complete' and stuff like that.
> Would be very nice :o)
>
> What would be the easiest method? At first I hoped a filter in Mail could
> call my app, but only Applescript appears supported in Panther. So then I
> was thinking a filter in Mail that would call an Applescript that in turn
> would call an application, but would the Applescript be able to forward the
> mail to my application? Is there a Cocoa object similar to NSMailDelivery
> that would allow me to check a specific email account for incoming
> 'download' emails instead? Or does anyone have an idea entirely better than
> doing this via email? ;o)
>
> Any suggestions greatly appreciated!
> Oli
>
>
>
>
> DISCLAIMER: The information contained in this e-mail is confidential and may
> be privileged. It is intended for the addressee only. If you are not the
> intended recipient, please delete this e-mail immediately. The contents of
> this email must not be disclosed or copied without the sender's consent. We
> cannot accept any responsibility for viruses, so please scan all
> attachments. The statements and opinions expressed in this message are those
> of the author and do not necessarily reflect those of the company. The
> company does not take any responsibility for the views of the author.
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden