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

Re: Cocerce Date


  • Subject: Re: Cocerce Date
  • From: Paul Berkowitz <email@hidden>
  • Date: Thu, 11 Jul 2002 02:00:19 -0700

If you have to do it within a tell block, you can also just write

tell me to set cdate to date ndate

--
Paul Berkowitz

> From: Michael Tompsett <email@hidden>
> Date: Thu, 11 Jul 2002 09:07:03 +0100
> To: <email@hidden>
> Cc: <email@hidden>
> Subject: Re: Cocerce Date
>
> I had a similar problem a while back and found out that the problem was
> because the line
>
> Set cdate to date ndate
>
> Was within the tell statement of an application (in this case quark)
>
> So it read
>
> Tell app quark
> Set ndate to contents of text field 3todate2 as string
> Set cdate to date ndate
> End tell
>
> When it should have read
>
> Tell app quark
> Set ndate to contents of text field 3todate2 as string
> End tell
> Set cdate to date ndate
>
> Basically, coercion doesn9t work between tell statements.
> Another good way is to set the date coercion as a subroutine which can then
> be called from within a tell statement. This is useful if you do not want to
> have to close a tell statement just to perform the coercion and then open
> the tell statement again. E.g
>
> Property cdate : {}
> On subdate(x)
> Set cdate to date x
> End subdate
>
> Tell app quark
> Set ndate to contents of text field 3todate2 as string
> Subdate(ndate) of me
> End tell
>
> Get in touch if you want any more help with it
> Mikeyt
>
>
>
> Paul wrote:
>> I want to take a date string from a text field and convert
>> it into a date.
>>
>> The first line accepts the string into nDate set the nDate
>> to contents of text field "toDate" as string
>>
>> The help says to coerse the string to a date as follows set
>> cDate to date nDate
>>
>> But when run I get Apple script error
>> NSReceiverEvaluationScriptError: 3 (1)
>>
>> What's wrong?
>>
>> I am new to Applescript but hey you have to start sometime!
>>
>> Thanks Paul Garfield
> _______________________________________________
> applescript-users mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/applescript-users
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Cocerce Date (From: Michael Tompsett <email@hidden>)

  • Prev by Date: Re: Preparing a lecture
  • Next by Date: Date formatter for me does NOT work
  • Previous by thread: Re: Cocerce Date
  • Next by thread: Date formatter for me does NOT work
  • Index(es):
    • Date
    • Thread