[vlc-devel] Fwd: Improved AppleScript support in VLC (code)

Derk-Jan Hartman hartman at videolan.org
Sat Aug 27 22:55:24 CEST 2005


Forwarding to developer mailinglist.

Anyone feels up to this?
Whatever you do, beware of vlc's multithreaded nature. Best get and  
set these value's directly on the controls. Come to think of it, you  
might be able to create MPSlider and ITSlider instead of  
VLCApplication pairs, to directly interact with the volume and  
position control????

DJ

Begin forwarded message:
> From: Jonas Salling
> Date: 25 augustus 2005 10:08:11 GMT+02:00
> To: hartman at videolan.org
> Cc: thedj at users.sourceforge.net
> Subject: Improved AppleScript support in VLC (code)
>
>
> Let me introduce myself. I'm Jonas Salling, the author of Salling  
> Clicker, a rather popular remote control tool for Mac OS X (and  
> soon also Windows).
>
> Many of my users use Clicker in conjunction with VLC. Clicker can  
> interact with Mac OS X applications both with synthetic HID events  
> and AppleScript. I'm writing you now, as I feel the experience for  
> Clicker/VLC users could be much improved had there been a more  
> robust support for AppleScript in VLC.
>
> I understand this sort of stuff is probably not something you're  
> prioritizing at this point (I've seen some comments in trac to that  
> effect), so I grabbed the source code from your SVN repository  
> thinking I could help out a bit; at least adding some of the things  
> I'd like to see, such as adding a scriptable application object  
> with properties for "player state", "audio volume", etc.
>
> I'm under great pressure to finish other work, so I wasn't able to  
> get very far in doing what I had set out to do (primarily, VLC  
> seems to have dependencies to libraries I don't have on my  
> machine). But I figured I should share with you how I think you  
> could easily improve the scripting aspects of VLC for OS X. If  
> you'd prefer for me to keep tinkering with this and send you the  
> results, let me know if there are any configure flags I can use to  
> compile and run at least the UI parts of the app on a stock 10.4.2  
> machine.
>
> Now, here's what I think you can do to get a scriptable application  
> object with some properties:
>
> vlc.scriptSuite
> ===============
> Define the "application" class with the properties you want. Insert  
> the following before "Commands":
>     <key>Classes</key>
>     <dict>
>         <key>VLCApplication</key>
>         <dict>
>             <key>AppleEventCode</key>
>             <string>capp</string>
>             <key>Attributes</key>
>             <dict>
>                 <key>Volume</key>
>                 <dict>
>                     <key>AppleEventCode</key>
>                     <string>Vp01</string>
>                     <key>ReadOnly</key>
>                     <string>NO</string>
>                     <key>Type</key>
>                     <string>NSNumber</string>
>                 </dict>
>             </dict>
>             <key>Superclass</key>
>             <string>NSCoreSuite.NSApplication</string>
>             <key>SupportedCommands</key>
>             <dict>
>             </dict>
>         </dict>
>     </dict>
>
> vlc.scriptTerminology
> =====================
> Make the corresponding changes:
>     <key>Classes</key>
>     <dict>
>         <key>VLCApplication</key>
>         <dict>
>             <key>Attributes</key>
>             <dict>
>                 <key>Volume</key>
>                 <dict>
>                     <key>Description</key>
>                     <string></string>
>                     <key>Name</key>
>                     <string>audio volume</string>
>                 </dict>
>             </dict>
>             <key>Description</key>
>             <string>The VLC application</string>
>             <key>Name</key>
>             <string>application</string>
>         </dict>
>     </dict>
>
> interface.c
> ===========
> Add a category on the VLCApplication class for the properties  
> (CocoaScripting will use key-value-coding to interact with  
> VLCApplication; the setter and getter methods correspond to the  
> names in scriptSuite, but with the getter-method starting always in  
> lowercase):
>
> @implementation VLCApplication (Scripting)
>
> - (NSNumber *)volume
> {
>     // do your thing here...
>     return [NSNumber numberWithInt:42];
> }
>
> - (void)setVolume:(NSNumber *)value
> {
>     // do your thing here [value intValue]...
> }
>
> @end
>
>
> ====================================================================== 
> ==========================
>
> Ok. This should be about all you have to do. I'm not sure how much  
> experience you have with AppleScript support implementations, so  
> please forgive me if you knew this already. Otherwise, I hope this  
> example gives you a better understanding of how easy it might be to  
> improve on VLC.
>
> Let me know if you have any questions or comments once you  
> (hopefully) get to this.
>
> Best.
> --
> Jonas Salling
>

-- 
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html



More information about the vlc-devel mailing list