How to change the list of file types which Safari will open immediately after download?

One way is to use Hazel. I tried using it and it worked smoothly. However, Hazel isn't free ($25).

The second solution is to use Automator which is part of Mac OS X.

However, using Automator didn't quite work. Some of the mp4 files did open, but for unknown reason some didn't.

Also I'm not sure if Automator has to open the files as soon as they are downloaded, or there is a time frame which it could take to open them. Maybe some one more experiences with Automator could elaborate on this.

Here is a how to create and use an AppleScript to open .lyx files:

Open AppleScript file named addSafariSafeList.scpt:

property auto_open_extension_list : {"lyx"}

on adding folder items to thisFolder after receiving addedItems
    tell application "Finder"
        repeat with addedItem in addedItems
            if name extension of addedItem is in auto_open_extension_list then
                my openFile(addedItem)
            end if
        end repeat
    end tell
end adding folder items to

on openFile(f)
tell application "Finder"
        open f

    end tell
end openFile

copy the file to ~/Library/Scripts/Folder Action Scripts

Note: I didn't have this folder, so I created both ~/Library/Scripts and ~/Library/Scripts/Folder Action Scripts

Now, go to ~/ in Finder, right click on Downloads folder, click Folder Action Setup. . .

List should appear and contain addSafariSafeList.scpt

Now you're good to go - whenever you'll download lyx file it should open automatically when ever you download it.

NOTE: If you want to open another file type, simply change property auto_open_extension_list : {"FileExtensionHere"}

NOTE II: If you want several types use: auto_open_extension_list : {"FileExtension1Here", "FileExtension2Here"}

Enjoy!