Auto-opening a downloaded file from a browser is done on pretty much a browser-to-browser basis. Since you asked about Chrome, here's the relevant blurb from Google's Docs:
Automatically open certain types of
files
If you want certain types of files to
always open after they're done
downloading, click the arrow next to
the file button in the downloads bar
and select Always open files of this
type. To prevent potentially malicious
files from automatically downloading
to your computer, this option isn't
available for executable filetypes,
such as those with .exe, .dll, or .bat
extensions (for Windows), and .dmg
extensions (for Mac).
Personally, these features weren't visible when I tried it, but then I hardly use Chrome other than for the odd web site test.
This turned out to be a more complicated problem than I originally expected.
QuickTime X cannot play MIDI files, although QuickTime 7 could.
As far as I can tell that means that there is no "built-in" solution to playing MIDI files on Mac OS X (for example, afplay
does not work). Therefore I believe that any solution will involve downloading and installing some other program.
Option #1: Download and install QuickTime 7 which still works fine on Mavericks, and then you can play midi files by:
open -a QuickTime\ Player\ 7 /path/to/your/file.mid
however that will only autoplay if the user has enabled that preference, which I believe is off by default.
Option #2: Use FluidSynth
To install it, you have to be using either Fink, MacPorts, or (my recommendation) Homebrew. Once Homebrew is installed, type this in Terminal:
brew install fluidsynth
(MacPorts' command would be sudo port install fluidsynth
and Fink's would be fink install fluidsynth
.)
However, downloading fluidsynth
only gets you part-way there. Then you need a "SoundFont" file, which I had never heard of before. There is information about them here
I downloaded one from S. Christian Collins called "GeneralUser" which is free. The current version (as of 2013-11-27) is FluidSynth version 1.44. {If that direct link breaks in the future, use the previous link which will take you to the regular web page for GeneralUser.}
Once you have downloaded and unzipped that, you will have a series of files including "GeneralUser GS FluidSynth v1.44.sf2" (obviously the name may change in the future). I renamed that file and moved it to /usr/local/share/fluidsynth/generaluser.v.1.44.sf2
.
Once the SoundFont file is place and fluidsynth
is installed, you can play a midi by using this command:
fluidsynth -i /usr/local/share/fluidsynth/generaluser.v.1.44.sf2 ~/Music/example.mid
n.b. There are some (seemingly harmless) error messages which get displayed when you do that. If you want to suppress them use:
(fluidsynth -i /usr/local/share/fluidsynth/generaluser.v.1.44.sf2 ~/Music/example.mid 2>&1) >/dev/null
instead.
Obviously I'm never going to remember all of that, so I made a zsh
function called playmidi
function playmidi {
SOUNDFONT='/usr/local/share/fluidsynth/generaluser.v.1.44.sf2'
if [ -e "$SOUNDFONT" ]
then
for i in "$@"
do
if [ -e "$i" ]
then
(fluidsynth -i "$SOUNDFONT" "$i" 2>&1) >/dev/null
else
echo "[playmidi]: cannot find file at $i"
return 1
fi
done
else
echo "[playmidi]: SOUNDFONT file not found at $SOUNDFONT"
return 1
fi
}
(That should work for bash
too I believe.)
Now all I have to do is type:
playmidi example.mid
and example.mid
will play.
Best Answer
Preview only works with PDF files and some image files (png, jpg, gif, tiff, bmp) so you won't be able to open a text file on Preview.
To open your info.txt file from terminal you need to choose an application that can open text files, like TextEdit or any other text editor.
You also could use
open -e file
, to open any file using TextEdit.