• 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: KOENIG Yvan <email@hidden>
  • Date: Sat, 9 Feb 2008 16:20:45 +0100


Le 9 févr. 2008 à 14:57, Skeeve a écrit :


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

It appears that iTunes is able to extract the date information linked to a track but is unable to work with it.
So, just stop speaking to iTunes, the Standard Additions will do their job.
To do that you may encapsulate the date related instructions in a tell to something else (you choose System Events but I'm sure that other ones would have did the same trick)
You may put the date related instructions in a handler. It's what I often does.


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
		my treatDate(y)
	end repeat
end tell

on treatDate(d)
	display dialog class of d
	display dialog year of d
end treatDate


An alternate track would be:


tell application "iTunes" set these_tracks to selection of front browser window set these_tracks_ref to a reference to these_tracks end tell repeat with tr in these_tracks_ref tell application "iTunes" to set y to date added of tr (* here we are not speaking to iTunes *) display dialog class of y display dialog year of y end repeat

Yvan KOENIG _______________________________________________
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: Axel Luttgens <email@hidden>
References: 
 >a date is not a date? Or: Why I sometimes hate AppleScript... (From: Skeeve <email@hidden>)

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