Page 1 of 1

AppleScript support

Posted: 25 Mar 2008 23:05
by OurMovies
although as Fkuehne has written in his post (viewtopic.php?f=12&t=43970&start=0&st=0 ... =a#p138523) that the applescript support is "really limited", i wonder if the vlc team is going to do something against that.
he also has written, that adding additional applescript support "should be fairly easy"... is that really the case? where can i find docu about that issue? what should i know/learn? which language (beside applescript itself)? objective-C?

the problem i got: i am writing a java application (for those who are interested: http://omov.sourceforge.net) which interacts with vlc via applescript. currently i am of need of the following features:
- determine if vlc is playing (because invoking the play command stops vlc if its running)
- select a certain item in the list (i added an element and want to play it, but if there are already items in the playlist, the topmost item will be played/stopped, depending on vlc's state)

Re: AppleScript support

Posted: 09 Apr 2008 23:58
by ptilol
If you can't wait for the promised rewrite of the applescript library, you can use this hack:

Prerequisite: Enable the Web interface of VLC.

Applescript:

Code: Select all

set vlcState to (do shell script "curl -s http://localhost:8080/requests/status.xml | grep '<state>' | cut -f2 -d'>' | cut -f1 -d'<'")
in the vlcState variable, you obtain "stop", "paused" or "playing". If VLC does not run, it will be an empty string.

Note that hacking around the HTTP interface of VLC actually open a huge lot of possibilities.

Enjoy automating!

Re: AppleScript support

Posted: 22 Apr 2008 21:34
by OurMovies
hm... nice, did not know of this web interface thing.
there is even a possibility from read the current playlist.

i think i am going to code some layer above this web interface -hopefully this "kind of api" is stable...

THANKS for the tip, helped a lot!

Re: AppleScript support

Posted: 21 Feb 2011 06:56
by tecpunk
tell application "Terminal"
do script "/Applications/VLC.app/Contents/MacOS/VLC --extraintf=http"
end tell