2007-01-05 02:14 pm (UTC)
I was going to suggest mapping F11 to an applescript which then gives VLC the focus and pauses the track. Presumably if you just wanted it quiet you could map a key to "Mute" which wouldn't of course pause the playing.
2007-01-05 03:16 pm (UTC)
Yes, that's right — I want to pause the playing, not just mute the sound. The main reason I want this is for use in situations where I really do need to stop and concentrate on something else at very short notice, and if I just press the mute button (or take the headphones off) then I forget I've done it and only notice later that I've lost my place. This is particularly an issue with audiobooks.
How do I map F11 to some applescript? And could you point me to a decent applescript reference? (I'd got as far as “I'll be wanting to use applescript for this, then”, but it's figuring out how that was the part I expected to involve time and cursing.)
You should be able to do something under
System Preferences -> Keyboard and Mouse -> Keyboard Short Cuts
As for Applescript, I have had a small play but I only know what is theoretically possible, not how to do it.
Resources can be found at:
and in the documentation installed with OSX.
Hope that helps.
2007-01-07 05:04 pm (UTC)
I was vaguely aware of it. I've sort of never trusted Perl on OS X for some reason, most likely because I've never really tried it. I probably should.
I've sorted the applescript now though, just need to work out how to make it execute when I hit F11.
looks like an interesting bit of AppleScript for muting play. http://dicot.biol.mcgill.ca/~bvalin/salling/salling.html
seems to be recommended as a way of pausing/playing in VLC. Though it seems to care about phone-calls, you could probably extract the bit of code that actually does the toggling. (Apparently, VLC has no way of telling you if it's playing or not, so it's a toggle, not a pause, IYSWIM.) Not having the ability to read .scpt files, I can't actually understand it, however. :-)
2007-01-07 04:59 pm (UTC)
Apparently, VLC has no way of telling you if it's playing or not, so it's a toggle, not a pause, IYSWIM.
Ooh, that was very useful, thank you! I now know that if VLC is playing, then osascript -e 'tell application "VLC" to play' will pause it.
Now to work out how to make that get executed when I hit F11...
You could maybe specify a keyboard shortcut in the system prefs or perhaps someone's written a plugin for quicksilver (which does this sort of thing for me with itunes)
2007-01-07 05:12 pm (UTC)
Quicksilver looks interesting. I do feel there must be some way of attaching applescript to a keyboard shortcut without installing anything third-party, though I haven't worked out what it is yet.
Step by step instructions (mainly because I think this is a good idea so I've done it myself now)
- Open Up Script Editor
- Type "tell application "VLC" to play" into the window
- Select "File" -> "Save As" from the menu
- Select "application" from the "file format" drop down
- Save as "ToggleVLC" in "/Applicaitons"
You should now have a double clickable application in /Applications that will pause/play VLC
Now, to get it to work in quicksilver:
- Trigger Quicksilver (that's Command-Space on my system, but it depends on how you've got it set up on your system
- Type Command-; to bring up preferences
- Ensure that the catalog has been rescanned. To do this either wait ten minutes, or...
- Click on "Catalog" on the toolbar.
- Click on "Applications" on the left:
- Click on the rescan button at the botom that looks like an anti-clockwise arrow
- Click on "Triggers"
- Click on the plus icon and select "hotkey"
- Type enough of "ToggleVLC" to select ToggleVLC, and hit return
- Double click on "None" next to "Open ToggleVLC".
- Click on "Edit" to the right of "Hot Key".
- Type F11
You might need to unbind F11 from Exposé before you can set the trigger correctly. This can be done from the "Dashboard and Exposé" in "System Preferences".
2007-01-09 12:35 am (UTC)
You are a genius. Thank you!
F11 F11 F11 F11 bounce bounce F11 F11