 |
 |
(AppleScript) iCal event class not really scriptable?
|
 |
|
 |
|
Professional Poster
Join Date: Oct 2001
Location: London
Status:
Offline
|
|
Hi,
I was wondering if anyone can see if I'm missing something here:
Is iCal's scripting rather weird? I seem to be able to create new calendars and events via applescript - but cannot "query" existing event objects.
e.g.
[php]
tell application "iCal"
set foo to event 1 of calendar 1
log foo
log class of foo
end tell
[/php]
doesn't work (NSCannotCreateScriptCommandError)
[php]
tell application "iCal"
set firstCal to first calendar
get description of firstCal
get every event of firstCal
end tell[/php]
also doesn't work ("iCal got an error: NSCannotCreateScriptCommandError")
Does iCal just not allow this kind of thing?
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Oct 2000
Location: Midwest
Status:
Offline
|
|
Assuming you know the calendar number (if not you need to use a whode clause by title),[php]tell application "iCal"
set iCalendar to calendar 1
tell iCalendar
make new event with summary "My New Event"
end tell
end tell[/php]
You can use a try block with 'get first event whose summary is "My new Event"' to access the event. Add a date parameter to further define the shose clause if appropriate.
HTH
Craig
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Oct 1999
Location: San Jose, Ca
Status:
Offline
|
|
I am able to get information like this:
Code:
tell application "iCal"
tell the first calendar
get the start date of the first event
end tell
end tell
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Oct 2001
Location: London
Status:
Offline
|
|
Hmmm - that gives me "NSCannotCreateScriptCommandError" - Is my copy of iCal broken? I am using v.1.5.3
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Oct 1999
Location: San Jose, Ca
Status:
Offline
|
|
Originally posted by Diggory Laycock:
Hmmm - that gives me "NSCannotCreateScriptCommandError" - Is my copy of iCal broken? I am using v.1.5.3
It could be... but I am also using a non 10.3 OS... so it could have been broken bug got fixed... someone with 10.3 want to verify?
Oh... and you do have a calendar defined in iCal, yes?
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Oct 2001
Location: London
Status:
Offline
|
|
I'm using an up to date version of the OS - that version was for iCal.
Yes - I have 4 calendars.
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Oct 2001
Location: London
Status:
Offline
|
|
How very bizarre - I just tried scripting iCal again - and now it's fine.
Must have been a temporary iCal spasm.
Thanks everyone.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |