From: peter (Peter da Silva) Date: 20:19 on 07 Aug 2005 Subject: Applescript How the hell do I add a file to iTunes using Applescript. I'm obviously holding my face wrong. Every example and the documentation says I do something like this: tell application "Finder" set theSelection to selection end tell tell application "iTunes" set thePlaylist to make new user playlist repeat with theFile in theSelection set theTrack to add theFile to thePlaylist end repeat my ps_play_next_ref(thePlaylist) delete thePlaylist end tell And it comes back with Can't make <<class cUsP>> id 42775 of <<class cSrc>> id 56 of application "iTunes" into the expected type. Or sometimes, it tells me Finder doesn't know how to add an alias to (the same kind of spew). Well, DUH, I didn't say "tell application "Finder"". And, by the way, things like "item 1 of blah" are something Grace Hopper would have come up with. Or maybe it's Larry Wall's idea of what COBOL should be like. I haven't used COBOL in years, and I still remember how tired I got of "perform monkey-balls through smelly-swamp". How about an Objective C scripting language, Apple? Something like: tell (application "Finder") { theSelection := [selection]; } tell (application "iTunes") { thePlaylist := [Playlist new]; while (theFile := [theSelection next]) { theTrack := [thePlaylist add: theFile]; } ps_play_next_ref thePlaylist; thePlaylist delete; } Then I wouldn't have to fucking guess how to convince it to use the right version of "add". God damn, get the basic syntax right, or at least internally consistent, and worry about frills later. All I want is that when I'm playing a song, I can cue a newly downloaded file in iTunes without it changing the playlist to the library and forgetting that I'm in Party Shuffle, or doing it all manually.
From: Paul Mison Date: 22:43 on 07 Aug 2005 Subject: Re: Applescript On 07/08/2005 at 14:19 -0500, Peter da Silva wrote: >How the hell do I add a file to iTunes using Applescript. > >I'm obviously holding my face wrong. - set theTrack to add theFile to thePlaylist + set theTrack to add (theFile as alias) to thePlaylist There's something deeply baffling about the five thousand ways AppleScript handles file references. Just look at the difference between POSIX file, file and alias. Then sit in the corner and cry a bit. >Or sometimes, it tells me Finder doesn't know how to add an alias to (the >same kind of spew). That's odd. Let me see... nope, works with an alias too. >And, by the way, things like "item 1 of blah" are something Grace >Hopper would have come up with. Or maybe it's Larry Wall's idea of >what COBOL should be like. I haven't used COBOL in years, and I >still remember how tired I got of "perform monkey-balls through >smelly-swamp". Would it help if I pointed out you can say "the first item of blah"? Somehow I suspect not. >How about an Objective C scripting language, Apple? Something like: Because Apple doesn't care about the jewel in its crown (come on, for all the AppleScript syntax is baffling, you point to anything anywhere else that comes close to the power that OSA allows you in terms of linking and connecting applications, even if you have to resort to System Events / GUI scripting, which is an evil, horrible, nasty hack) and instead is happy to put out gewgaws like Dashboard which use bloody Javascript, and which their own (much lauded) development environment can't actually build properly. Note to editor: is this spicy enough to be hate yet? Oh, and if you're really that bothered about AppleScript as the OSA language, have you considered appscript, the Javascript OSA component or Mac::Glue?
From: peter (Peter da Silva) Date: 23:58 on 07 Aug 2005 Subject: Re: Applescript > Would it help if I pointed out you can say "the first item of blah"? If you keep this up you're going to owe me a new unexploded head. > Oh, and if you're really that bothered about AppleScript as the OSA > language, have you considered appscript, the Javascript OSA component > or Mac::Glue? I think I'd rather use Applescript than Python or Perl. Javascript, though, is quite a nice language. I'll check that out. Why can't you use this from Dashboard, though?
From: David Champion Date: 06:37 on 08 Aug 2005 Subject: Re: Applescript * On 2005.08.07, in <f05210606bf1c2e80c2ad@xx.x.x.xxx>, * "Paul Mison" <paulm@xxxx.xxx> wrote: > > Because Apple doesn't care about the jewel in its crown (come on, for If AppleScript is the jewel in Apple's crown, we're all doomed. > all the AppleScript syntax is baffling, you point to anything > anywhere else that comes close to the power that OSA allows you in Not that this is precisely what you're saying, Paul, but I love it when Apple people coo and drool about how insightful it was to invent application scripting. I'm no fan of Rexx either, but. > Oh, and if you're really that bothered about AppleScript as the OSA > language, have you considered appscript, the Javascript OSA component Thanks for this tip. I really like bloody Javascript, and I can even think of it as a language, which gets it off the starting block where Apple"script" false-starts every time.
From: Peter da Silva Date: 13:43 on 08 Aug 2005 Subject: Re: Applescript On Aug 8, 2005, at 12:37 AM, David Champion wrote: > Not that this is precisely what you're saying, Paul, but I love it > when Apple people coo and drool about how insightful it was to invent > application scripting. I'm no fan of Rexx either, but. Wow, a scripting languages double-header. REXX vs Applescript. From a hate perspective that's a win-win combo.
From: Earle Martin Date: 20:16 on 01 Sep 2005 Subject: Re: Applescript On Mon, Aug 08, 2005 at 12:37:12AM -0500, David Champion wrote: > If AppleScript is the jewel in Apple's crown, we're all doomed. Who this "we", kemo sabe?
Generated at 10:27 on 16 Apr 2008 by mariachi