• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: a date is not a date? Or: Why I sometimes hate AppleScript...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: a date is not a date? Or: Why I sometimes hate AppleScript...


  • Subject: Re: a date is not a date? Or: Why I sometimes hate AppleScript...
  • From: deivy petrescu <email@hidden>
  • Date: Sat, 9 Feb 2008 11:29:26 -0500


On Feb 9, 2008, at 8:57, Skeeve wrote:

I needed almost half an hour before I found a working solution but still don't know:
a) Why I need this construct
b) How one should have known


I tried this:
set x to current date
display dialog class of x
display dialog year of x

tell application "iTunes"
 set these_tracks to selection of front browser window
 set these_tracks_ref to a reference to these_tracks
 repeat with tr in these_tracks_ref
     set y to date added of tr
     display dialog class of y
     display dialog year of y
 end repeat
end tell


"year of x" works "year of y" fails

I really needed almost half an hour to find that this works:

set x to current date
display dialog class of x
display dialog year of x

tell application "iTunes"
 set these_tracks to selection of front browser window
 set these_tracks_ref to a reference to these_tracks
 repeat with tr in these_tracks_ref
     set y to date added of tr
     tell application "System Events"
         display dialog class of y
         display dialog year of y
     end tell
 end repeat
end tell

As people have already pointed out, this is a clash in nomenclatures. iTunes defines year as a property of audio CD playlist. -----

audio CD playlist n [inh. playlist > item] : a playlist representing an audio CD

elements
contains audio CD tracks; contained by sources.
properties
...
year integer : the year the album was recorded/released
----

Inside the iTunes wrapper, "display dialog year of x" will fail as well.
The solution is, as you pointed out, get the year of date via another app that that does not have this name conflict.



As for you hating AS, this is your call, but mostly I feel that problems arise because of the implementors.
In this case, I would have some difficulties in understanding why one would need a property year of an audio playlist if by default one who works with AS would get it from a date.


In my case I have to say the following for AS, it is the major reason that all my next computers will be running MacOS and not Linux.
AS is extremely powerful and versatile. It can be frustrating at times but so what? The payoff is well worth the pain!



Deivy

_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: a date is not a date? Or: Why I sometimes hate AppleScript...
      • From: has <email@hidden>
References: 
 >a date is not a date? Or: Why I sometimes hate AppleScript... (From: Skeeve <email@hidden>)

  • Prev by Date: Re: a date is not a date? Or: Why I sometimes hate AppleScript...
  • Next by Date: Re: PHP and Applescript
  • Previous by thread: Re: a date is not a date? Or: Why I sometimes hate AppleScript...
  • Next by thread: Re: a date is not a date? Or: Why I sometimes hate AppleScript...
  • Index(es):
    • Date
    • Thread