• 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: vdate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: vdate


  • Subject: Re: vdate
  • From: Nigel Garvey <email@hidden>
  • Date: Tue, 6 Nov 2001 14:33:59 +0000

Christopher Nebel wrote on Mon, 5 Nov 2001 17:21:55 -0800:

>On Monday, November 5, 2001, at 08:56 AM, Robert Poland wrote:
>
>> The following crashes on my wifes 6100, OS 8.1. I tried Applescript
>> 1.1.3.
>>
>> set DateString to "" & (vDate)'s month & " " & (vDate)'s day & ", " &
>> (vDate)'s year -- month, day, year
>>
>> Error says it cannot make month "November into a string".
>
>Yep. The month of an AppleScript date object isn't really a string,
>it's an enumeration, and AppleScript didn't support coercing
>enumerations to strings prior to 1.4. Since you're using 1.1.3, you'll
>have to do it the hard way, like this:
>
> if (vDate)'s month is January then
> set m to "January"
> else if (vDate)'s month is February then
> set m to "February"
> (etc.)

Or of course there's the old 'error message' trick:

try
set m to vDate's month as string
on error msg
set m to word 3 of msg
end try

This assumes that vDate is a valid date. There's no error with later
AppleScript versions, but with earlier versions, the month name string is
taken from the error message. The result is styled text, but I don't
think this would be a problem.

NG


  • Prev by Date: Re: Sorting with Akua Sweets
  • Next by Date: Re: Novice question
  • Previous by thread: Re: vdate
  • Next by thread: Re: SoundJam had it first (was Re: iTunes coupe)
  • Index(es):
    • Date
    • Thread