Re: scripting data into sheets
Re: scripting data into sheets
- Subject: Re: scripting data into sheets
- From: Paul Berkowitz <email@hidden>
- Date: Thu, 03 Feb 2005 09:04:03 -0800
On 2/3/05 8:34 AM, "Adam K. Wuellner" <email@hidden> wrote:
> On Feb 3, 2005, at 10:13 AM, rob ly wrote:
>
>> iCal lets user go to a specific date. This is done through a sheet
>> that come forth and ask for a date.
>> How would I script a user enter date into this sheet?
>
> Why would you, when you can do this instead?
>
> tell application "iCal"
> view calendar at (date "Sunday, October 2, 1977 2:33:00 AM")
> end tell
>
I think he may want to let the user choose. Something along these lines:
display dialog "Open iCal to which date?" default answer ""
set textDate to text returned of result
tell application "iCal"
view calendar at (date textDate)
end tell
AppleScript is really good at understanding dates in all sorts of formats,
but you'd need to run an error check in a repeat loop to make sure a valid
date was entered. Something like:
set done to false
display dialog "Open iCal to which date?" default answer ""
repeat until done
set textDate to text returned of result
try
set theDate to date textDate
set done to true
on error
beep
display dialog textDate & " is not a valid date format. Try
again." & return & return & "Open iCal to which date?" default answer ""
end try
end repeat
tell application "iCal"
view calendar at theDate
end tell
--
Paul Berkowitz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden