Send to Printer

smalltalk

iTunes from ObjectStudio

November 10, 2006 22:18:27.553

Having shown how to hit iTunes from VW, here's how I did the same thing in ObjectStudio. OST is more Windows oriented, so things were a bit simpler:


"Get a COM interface and a dispatch object"
ole := OLEObject newProgId: 'iTunes.Application'.
dispatcher := ole dispatcher.

"get the Playlist interface"
libPlay := dispatcher at: 'LibraryPlaylist'.

"Now add the file"
result := libPlay call: 'AddFile' params: (Array with: 'h:\audio\industry_misinterpretations_10-14-06.mp3').

Refer back to the same image from the previous post; it all worked the same way :) COM from Smalltalk isn't quite as hard as I thought it was.

Technorati Tags: , ,

Comments

the problem with COM

[ Troy Brumley] November 11, 2006 9:21:33.483

Comment by Troy Brumley

As I noted over on my blog, I've been fumbling around in COM in my day job as well. I finally grokked interfaces and it all makes much more sense. Its problems in my opinion are its obscure configuration (if you think XML files are bad, try chasing through the registry) and a general lack of run time relfection. It's all very C++ and precompiler oriented. If I'd designed it, IUnknown would include a "here's a list of all my supported interfaces" method.

The other thing to watch for is ref counting. I think the ObjectStudio OLE support handles that well, but I can't swear to it.

How about the Mac?

[James T. Savidge] November 11, 2006 10:01:58.122

How about doing the same with whatever is the non-COM way to the same for MacOSX? :-)

applescript

[Troy Brumley] November 11, 2006 10:16:53.246

I suspect that involves AppleScript, though a lower level objective-C interface might exist. VW isn't script aware so far as I know. It might be possible to fire off a shell process to do this though. I'm not at all experienced with AppleScript, but if someone cooked up a callable script for this, I'm sure it could be fired off from VW. I did find someone doing some Perl access into iTunes on the macdevcenter at O'Reilly, but I am not up for Perl this early in the morning :)

AppleScript

[ James Robertson] November 11, 2006 11:24:42.085

Comment by James Robertson

James,

I'd like to do that. Any suggestions on screencast software (I use Wink on Windows) for the Mac?

Screencasting for the Mac

[James T. Savidge] November 11, 2006 13:40:19.163

James, Because found multiple weblinks, I sent you an email with information about screencasting software on the Mac.

 Share Tweet This