Given the choice, I’d much rather watch DVDs on my Mac with the great free app VLC rather than the lame “DVD Player” that is included with Mac OS X. How the heck do I do that?
First off, credit where it’s due: a succinct, albeit somewhat confusing answer to this question is offered up by Michal over at Macosxhints.com (see here). The problem is, most Mac users have no idea how to “create and save” an AppleScript. So let me offer up a more detailed tutorial.
First off, if you just want VLC to start up when you insert a DVD, but you’ll have to actually find the DVD then click “play” to get it to start playing the movie, that’s easy. Go to Apple Menu –> System Preferences and choose “CDs & DVDs”:
Click it and you’ll see this:
To have VLC start up instead of DVD Player, simply click on the “Open DVD Player” menu, choose Open Other Application, find VLC in your Applications folder, and click “Choose”. That’s all there is to it. If you don’t mind having to munge around in the file system to find the newly inserted DVD and click “Play” each time. 🙂
There’s a smarter alternative, as Michel shows, but it requires you opening up the AppleScript editor and writing a very short little program…
Start out by launching Applications –> Apple Script –> Script Editor. You’ll see this starting window:
Now, ever so carefully, type in exactly the following:
OpenURL “dvdnav:///dev/rdisk1”
play
next
end tell
It’ll look like this with the automatic formatting in the Script Editor:
Almost done. Really. You can do it. 🙂
Now, just choose File –> Save and save the script in a well-known location. I suggest the same place that you have the VLC app, or a new directory called “Scripts” in your Applications folder. Here’s what I did:
Last step. Back up in this article to where I show you how to choose VLC instead of DVD Player and instead of choosing VLC in the “CDs & DVDs” system preference, choose “Run Script…” and choose your new script. When I do that, I now see:
That’s all there is to it. Now when you insert a DVD, VLC launches and starts playing the movie!
By the way, I don’t think it’ll take long for the crack team at Videolan.org to add “autoplay newly inserted DVD” as a preference, and perhaps even to allow you to specify a preferred view too (e.g., normal, half size, full screen, etc). That’d be kewl…
Thanks all (well except Frank*), very helpful.
*dear Frank, you do know that many of us own multiple platforms, and that includes PC’s. I can give you a long list of things that are good and bad on all of these platforms, and that includes PC’s. Also, ROFLMAO of Windows 8 (which I own and use daily).
buy a cheap p.c. and end all of your troubles.
James Ferguson’s script works well for me on a new Imac, so thanks! I did notice that if I have left a disk image (.dmg) mounted (from a software download) then VLC will stop and wait for you to select the one you want to play. Is there a way of distinguishing the DVD drive automatically?
Cheers
Gary
I got a syntax error until I changed OpenURL to Open URL.
Hope this helps 🙂
bisk
My toyota corolla 2011 car dvd is not running dvd casette and showing any picture or sound but screen is running back camera and fm radio.please tell what is the problem and solution of that is there be a sotfware problem tell who can I install and download software from internet for my carkit dvd to play. THANKS IN ADVANCE.
I ran into an error where the compiler expected a line end after OpenURL for some weird reason.
So I worked off Keith Savage’s script but had to get around another weird “error code -10827” problem, which apparently means the system can’t find the VLC app for some reason.
I also found Keith’s nested ‘tell application “VLC”‘ didn’t work because it claimed it didn’t know the play or fullscreen commands. So I replaced that with more key events.
If you use this I’d suggest starting with all the delays set to 10 or higher and then use trial and error to lower them to the lowest value that works reliably – it’ll depend on the speed of your system.
The script:
————————–
# To avoid the unhelpful “error code -10827” which means the
# system can’t find the “VLC” app use the following
tell application “Finder” to open application file id “org.videolan.vlc”
delay 1
tell application “System Events”
# Hold ‘Command’ and press ‘d’
# Cmd + d is the VLC hotkey for “Open Disc…”
key down command
keystroke “d”
key up command
delay 2
# Pressing ‘Return’ clicks the ‘Open’ button and
# plays the default DVD
keystroke return
delay 8
# Cmd + f is the hotkey for fullscreen
# It’ll only work if the DVD is already playing so, like
# all the delays in this script, tune the number to your
# system.
key down command
keystroke “f”
key up command
end tell
I had problems with this script, whenever I added, or removed external disk (even a thumb drive), the rdisk value changed. It finally bugged me enough to do something about it (read that as: My wife and kids finally bugged me enough to do something about it), and here is the result.
tell application “VLC”
activate
end tell
tell application “System Events”
key down command
keystroke “d”
key up command
delay 3
keystroke return
tell application “VLC”
play
fullscreen
end tell
end tell
This end-routs the issue, just make sure that UI scripting is turned on. If your system is faster than my G4, you might not need the ‘delay 3’.
Peter
When I plug in my Seagate Free agent via the usb 2 port, my PC show it but I get a message from my Avira AntiVir program that the auto run is blocked when I look in properties for that drive it does not show an auto play tab, when I check all the other drive properties the auto play option is not on those drives either. I am running Windows XP
I have VLC installed on my HP desktop PC,I have XP 64 Home.VLC will play commercial DVDs but not Burned DVDs-Everyone says that they don’t have this problem,I use the “simple” setting,how can I get non-commercial DVDs/CDs to play using VLC?Thanks for your time.
Thanks much for this info, folks.
DVD script worked like a charm. As did the CD script – except that on my Mac Mini running Snow Leopard the device designation had to be “cdda:///dev/rdisk1” to work properly.
Cheers all …
Dave, I have a HP Pavilion zx6000. After Best Buy replaced my DVD burner, it would not automaticlly start any dvds or music cds. I have set up the pref.s to play under the DVD-RW (D:) Properties, autoPlay. It still doesn’t work. Any suggestions?
For some reason, the device designation on the mac mini w/OSX 10.5.7 needs to be “cdda:///dev/rdisk2”, or vlc throws a bunch of errors about dvdnav and doesn’t auto play a CD.
One more thing…
If you’re using an external DVD connected by firewire, in the 2nd line change “rdisk 1” to “rdisk2”.
For example: OpenURL “dvdnav:///dev/rdisk2”
Otherwise you will get an error message as VLC will try reading from your internal DVD drive (rdisk1).
A couple of changes to your fine script, one to bring vlc to the front and the other to automatically change to full screen mode:
tell application “VLC”
activate
OpenURL “dvdnav:///dev/rdisk1”
play
next
fullscreen
end tell