When I realised that the iPhone didn’t support downloading files natively, I was back to square one. Then I thought of using Dropbox — but that didn’t work. After a couple of hours of research, I finally found a solution, albeit a pretty rudimentary one. It involves a secondary email, Mail rules, Transmission or uTorrent and Applescript. Now, let’s be clear on this: I’m not a scripting geek. I’m just an average Mac user. But the fact that I actually wrote this script is a clear testament to how easy it is to learn the Applescript language. I digressed.
Here’s how I managed to set up Mail and Transmission to automatically download torrents sent via email.
First of all, we need to write the script. But since this is MakeUseOf, I’ve already written it for you. Download the appropriate version depending on which torrent client you use.
Unzip the file and store the script somewhere safe, for example within the scripts folder located at /Library/Scripts/.
If you prefer to compile the script yourself, here’s how it looks like:
(*Transmission via email by Jackson Chung*)Before we proceed, let me explain that we are going to set a rule to detect torrents sent from a primary email to a secondary email. So in this case, you’ll need to 2 separate email accounts.
using terms from application “Mail”
on perform mail action with messages theMessages for rule Torrent
tell application “Mail”
repeat with theMessage in theMessages
set theText to content of theMessage
set the clipboard to (theText)
end repeat
end tell
tell application “Transmission” to activate
tell application “System Events”
tell process “Transmission”
keystroke “u” using {command down}
keystroke (theText)
key code 36
end tell
end tell
end perform mail action with messages
end using terms from
Now launch Mail (assuming you inherently use Mail; if not, you’re out of luck) and enter its Preferences. Click on the Rules tab and add a new rule. Name it “Torrent“, then set the condition to “all”, as in “If all of the following conditions are met”. Next, set the rule conditions as you see in the screenshot below:
From – is equal to – your@emailaddress.comPerform the following actions:
Subject – is equal to – Download torrent
Mark as ReadClick on OK and click on “Don’t Apply” if asked Do you want to apply your rules to messages in selected mailboxes?
Run Applescript – Click the choose button and locate the Applescript you’ve just downloaded
Mail is now set. For every email from your@emailaddress.com with the subject “Download torrent”, it will trigger the Applescript. Perfect, just what we want.
Now, let’s set Transmission. Enter its Preferences and check the box for “Start transfers when added” and make sure to uncheck “Display “adding transfer” options window”. We want Transmission to automatically start torrents without intervention. OK, Transmission is now set as well.
Now then comes the interesting part. How do we format the email? It’s pretty simple. The Applescript is set to copy the content of the message so all you need to add is the URL to the torrent. Remove your email signature or it won’t work. From my iPhone, all I do is hold down on a link until the contextual menu appears. I tap on Copy and launch Mail on my iPhone.
Then paste the torrent URL into the content of the message and remove everything else i.e. signatures, etc. Click Send and watch the magic happen.
- *Mark it as read;
*Start the Applescript which then;
*Launches Transmission or uTorrent;
*Opens a torrent location from a URL;
*Enters the URL into the field and clicks OK;
*Starts downloading the torrent.
0 comments:
Post a Comment