Applescripts to control VLC

I wanted to control my VLC player via Quicksilver just like I am able to do with iTunes, but I was unable to find anything online so I decided to write my own. Here are a few code snippets that you can use to control iTunes.

I will go over how to use them with Quicksilver later.

Open Multiple Files

# get the music we want to load
set Music to choose file with multiple selections allowed without invisibles
 
# open the selected music
tell application "VLC" to open Music
 
# start from the beginning
tell application "VLC" to next

Open Multiple Folders(This one has timing issues you have have to alter the times around, if you have any suggestions as to how to fix it PLEASE let me know)

# get the music we want to load
set Music to choose folder with multiple selections allowed
 
# open the selected music
tell application "VLC" to open Music
 
############################
# Get music start start from top not bottom
###########################
 
set MusicCount to count Music
set MusicCount to MusicCount - 1
 
# stop the music playing
tell application "VLC" to stop
 
# wait a moment so that vlc has time to catch up minimum of 0.3 plus how ever many folders are being loaded this seems to be the right amount of time for vlc to know what is going on
set DelayCount to (MusicCount / 10) + 0.3
 
delay DelayCount
 
# now start to play the music
tell application "VLC" to play
 
# start from beginning
repeat MusicCount times
	# loop seems to work better with delay at beginning
	delay DelayCount
	# must let vlc catch up
	tell application "VLC" to previous
end repeat

Simple VLC controls

#play/pause
tell application "VLC" to play
 
#next
tell application "VLC" to next
 
#previous
tell application "VLC" to previous
 
#volume up
repeat 5 times
	tell application "VLC" to volumeUp
end repeat
 
#volume down
repeat 5 times
	tell application "VLC" to volumeDown
end repeat

recent comments