Category Archives: AppleScript

AppleScript IOS

Email Attachment to Dropbox

Unlike Box.net and Evernote Dropbox does not currently allow you to email a files to your account.

There is at least one service that providers this functionality but I prefer not to involve third parties with my data where I can avoid it.

Credit must go to the person who wrote this script (can’t seem to find where I found it) but with some slight modifications I can now send a file to Dropbox by emailing it to a nominated personal email account.

In Mail I have a rule that runs for on a particular account that will call this script when a new message arrives. The script will save a copy of any attachments to my local Dropbox folder (in this case a called Attachments), within seconds the file will be synced to my online Dropbox account. This enables me then to open the file from one of my IOS apps.

Simple but very effective. Here is the code;

**********

using terms from application “Mail”

on perform mail action with messages theMessages for rule theRule

tell application “Mail”

repeat with oneMessage in theMessages

set {mail attachment:theAttachments} to oneMessage

repeat with oneAttachment in mail attachments of oneMessage

save oneAttachment in (“(your Hard Drive name):Users:(your user name):Dropbox:Attachments”;) & (name of oneAttachment)

end repeat

end repeat

end tell

end perform mail action with messages

end using terms from

 

AppleScript Software

Simplifying organising multimedia files with iTunes

I like to keep my files so that they are in a structure that keeps everything organised. I have found that by accepting the limitations of iTunes it is the best tool that can utilised on the Mac.

The advantage is by using iTunes that it is easier to share the files with you iPhone, iPad and Apple TV.

Problem is that it can be quite laborious to rename, convert, import and categorise files. I found an tutorial at Mactalk.com.au that gave some ideas, but due the numerous naming conventions that exist for video files the aim to fully automate the process was unachievable. The other issue was that there was little control of the renaming and categorising of the TV Shows and Movies.

While free software may exist to replace the following commercial applications I use I think the overall cost for what is acheived is well worth the investment.

  • Hazel (should be a standard app in all Macs)
  • Turbo 264 (hardware and software)
  • iFlicks
  • TuneUp
  • NZBVortex (optional)

NZBVortex is a great piece of software that makes it very easy to obtain the newest episodes ot TV Shows or Movies that you are interested in. It  can identify new files from RSS feeds and automatically grab the NZB file to start the download process. If you are into NZBs you need this software.

While a fully automated system would be great I found that you can’t totally eliminate manual intervention, The following procedures I have implemented has reduced my resource investment by about 90%.

Downloads

1. Create a rule in Hazel to move MP3s to the Automatically Add to iTunes sub folder found in the Itunes library location. This will import the songs into Itunes using the ID3 tags that already exist in the files. These may be inaccurate or incomplete but this will be corrected later.

2. Via a Hazel rule move all video files to a folder that you have created for the purpose of converting to a format that can be imported in to iTunes. I use the Apple TV format as I find that it works in all of my devices.

Convert

3. Create a rule in Hazel using Applescript to automatically convert the video files using Turbo.264 HD, here is the code for this rule;

**********

– Waits till Turbo.264 is not running to start this portion of workflow

tell application “Finder”

repeat until name of processes does not contain “Turbo.264″

delay 5

end repeat

end tell

– Adds file using Hazel’s theFile call

tell application “Turbo.264 HD”

add file theFile exporting as AppleTV

encode

end tell

tell application “Turbo.264 HD”

repeat while isEncoding

delay 5

end repeat

tell Application “Turbo.264 HD” to quit

end tell

**********

Add another rule in Hazel to move the original file to trash.

4. In Turbo.264 HD have all output saved to a folder ready for renaming and adding of metadata. Elgato have now released a software only conversion application that could be used instead of the hardware/software solution.

5. Another Hazel rule runs on the output folder that automatically adds the files to iFlicks, here is the Applescript code;

**********

tell application “iFlicks”

import theFile with gui

end tell

**********

6. Here is the first time I have had to get involved in the process. Review the files in iFlicks,  if you are lucky the file will be recognised automatically and will be categorises as either a Movie or TV Show, metadata added with details of Actors, Directors, Plot etc and the Cover-art.

If there is a problem it usually just requires a manual rename or categorisation, you can then rerun the metadata lookup and it will add the required information. I generally find that about 75% will be correctly recognised.

Once that is done just press Start and it will rename the files based on the metadata, save and sort the files based on the Rules that you have utilised in iFlicks (very similar function to Hazel), finally it will add the listing into Itunes.

iFlicks

7. Going back to step 1. check the MP3s in iTunes. If you find any with incorrect metadata or missing covers drag them onto the TuneUp window and run the Clean process. It will analyse the songs and grab the required information from the internet. This will then ensure that your collection is nice and tidy.

Well thats about it, my involvement is minimal but I have a collection of media that is correctly named and filed and has accompanying metadata that displays my media perfectly, not matter what device I choose to access it with.