Re: Help with validating a date input to a dialog
Re: Help with validating a date input to a dialog
- Subject: Re: Help with validating a date input to a dialog
- From: Paul Berkowitz <email@hidden>
- Date: Fri, 30 Mar 2001 17:29:21 -0800
On 3/30/01 4:54 PM, "Michelle Steiner" <email@hidden> wrote:
>
Here's the script:
>
>
display dialog (my setthedate("Please enter the date in format
>
"mm/dd/yyyy"."))
>
>
on setthedate(prompt)
>
set DateToSend to (text returned of (display dialog prompt default
>
answer ""))
>
try
>
date DateToSend
>
on error
>
my setthedate("Please us the correct format "mm/dd/yyyy"")
>
end try
>
return DateToSend
>
end setthedate
You forgot to escape the internal quotation marks in strings (both places).
I can't even get it to compile without them, so I don't know how you're
getting that error. Is there something slightly different in the way you
have it in Script Editor. This works fine:
display dialog (my setthedate("Please enter the date in format
\"mm/dd/yyyy\"."))
on setthedate(prompt)
set DateToSend to (text returned of (display dialog prompt default
answer ""))
try
date DateToSend
on error
my setthedate("Please us the correct format \"mm/dd/yyyy\"")
end try
return DateToSend
end setthedate
--
Paul Berkowitz