Last modified 8 months ago Last modified on 2011-09-09 15:21:13

| Home | Browse Source | Plugins MacOS X Leopard | Download | Sample

  • Platform: Mac OS X 10.5
  • Version: v11
  • Type: Plugin
  • Current Version: 3.3.2

iCal

  • Summary

    This plugin is a Mac OS utility to manipulate iCal from 4D, using the CalCalendarStore class API.
  • Change List for 3.3

added the following commands.

iCal Count event alarms
iCal Get event alarm
iCal Remove event alarm
iCal Set event alarm

iCal Count task alarms
iCal Get task alarm
iCal Remove task alarm
iCal Set task alarm

Fixed iCal Set task property which was not working.

  • Change List for 3.2

Fixed iCal Set alarm property which was not working.

  • Change List for 3.1

the "get" command will NOT overwrite the receiver variable, if the access has failed because of invalid id, etc.
this was a new bug introduced in 3.0.

iCal_Get_event_property
iCal_Get_alarm_property
iCal_Get_task_property
iCal_app_Get_event_property
iCal_app_Get_task_property

  • Change List for 3.0

Commands have been added to receive notification from the system dispatch.

iCal Set notification method
iCal Get notification method

  • Change List for 2.1

Commands have been added to better manipulate the iCal application.

iCal SHOW EVENT
iCal SHOW TASK
iCal SET VIEW
iCal SHOW DATE

Command now accepts an optional $2, where the calendar names are returned.

iCal GET CALENDAR LIST

Command now woks with kmapper.

iCal Get alarm property
iCal Set alarm property

Fixed crash when url is not a file url.

iCal Get alarm property
iCal Set alarm property

Fixed crash when dates are invalid.

iCal Create event

Fixed crash when certain fields are empty.

iCal Get event property

Important Notice: Due to (suspected) API restriction, when events or tasks are modified externally, subsequent calls in the same 4D process to iCal Get event property, etc. will return the old value.

You need to call the function in a new 4D process to get the latest information.

Consequently, for debug purposes, 2 commands, that talk directly to the iCal application have been added.

iCal app Get event property
iCal app Get task property

Event Commands

iCal Create event

event:=iCal Create event (calendar; startDate; endDate)

calendar (TEXT)

The calendar ID to which this event belongs.

startDate (TEXT)

The start date in text format. Use the utility command iCal Make date to composite date, time and timezone. Must not be after the end date.

endDate (TEXT)

The end date in text format. Use the utility command iCal Make date to composite date, time and timezone. Must not be before the start date.

event (TEXT)

The event ID of the new event if the command is successful, or else an empty string. The error text is logged in the console.
  • Discussion
This command creates a new event, saves it, and returns its UUID.

iCal Get event property

success:=iCal Get event property (event; key; value; date)

event (TEXT)

The event ID.

key (TEXT)

The name of the property to read.

You can use a iCal Event Properties constant for key.

value (TEXT)

The value of this property.

date (TEXT)

Optional argument to specify one instance of a recurring event.

success (LONGINT)

1 for success, 0 for failure.
  • Discussion
This command will attempt to read a property of an event.

iCal Remove event

success:=iCal Remove event (event)

event (TEXT)

The event ID.

success (LONGINT)

1 for success, 0 for failure.
  • Discussion
This command will attempt to remove an event.

iCal Set event property

success:=iCal Set event property (event; key; value; date)

event (TEXT)

The event ID.

key (TEXT)

The name of the property to set.

You can use a iCal Event Properties constant for key.

value (TEXT)

The new value for this property.

date (TEXT)

Optional argument to specify one instance of a recurring event.

success (LONGINT)

1 for success, 0 for failure, or one of the following error codes; 1025 CalCalendarNotEditableError 1026 CalDateInvalidError 1027 CalCalendarNotInRepository 1028 CalCalendarTitleNotUniqueError The error text is also logged in the console.
  • Discussion
This command will attempt to update a property of an event and save it. Date values should be passed in textual form, which can be created with the iCal Make date command. Boolean values can be passes as YES/NO, TRUE/FALSE, etc.

Task Commands

iCal Create task

task:=iCal Create task (calendar; dueDate)

calendar (TEXT)

The calendar ID to which this task belongs.

dueDate (TEXT)

The due date in text format. Use the utility command iCal Make date to composite date, time and timezone.

task (TEXT)

The task ID of the new event if the command is successful, or else an empty string. The error text is logged in the console.
  • Discussion
This command creates a new task, saves it, and returns its UUID.

iCal Get task property

success:=iCal Get task property (task; key; value)

task (TEXT)

The task ID.

key (TEXT)

The name of the property to read.

You can use a iCal Task Properties constant for key.

value (TEXT)

The value of this property.

success (LONGINT)

1 for success, 0 for failure.
  • Discussion
This command will attempt to read a property of a task.

iCal Remove task

success:=iCal Remove task (task)

task (TEXT)

The task ID.

success (LONGINT)

1 for success, 0 for failure.
  • Discussion
This command will attempt to remove a task.

iCal Set task property

success:=iCal Set task property (task; key; value)

task (TEXT)

The task ID.

key (TEXT)

The name of the property to set.

You can use a iCal Task Properties constant for key.

value (TEXT)

The new value for this property.

success (LONGINT)

1 for success, 0 for failure, or one of the following error codes; 1025 CalCalendarNotEditableError 1026 CalDateInvalidError 1027 CalCalendarNotInRepository 1028 CalCalendarTitleNotUniqueError The error text is also logged in the console.
  • Discussion
This command will attempt to update a property of a task and save it. Date values should be passed in textual form, which can be created with the iCal Make date command. Boolean values can be passes as YES/NO, TRUE/FALSE, etc.

Calendar Commands

iCal Create calendar

calendar:=iCal Create calendar (title; color)

title (TEXT)

The name of this calendar, which must be unique.

color (TEXT)

An optional parameter to assign a color to this calendar. If omitted, iCal will automatically choose an index color.

calendar (TEXT)

The task ID of the new calendar if the command is successful, or else an empty string. The error text is logged in the console.
  • Discussion
This command creates a new calendar, saves it, and returns its UUID.

iCal Get calendar property

success:=iCal Get calendar property (calendar; key; value)

calendar (TEXT)

The calendar ID.

key (TEXT)

The name of the property to read.

You can use a iCal Calendar Properties constant for key.

value (TEXT)

The value of this property.

success (LONGINT)

1 for success, 0 for failure.
  • Discussion
This command will attempt to read a property of a calendar.

iCal Remove calendar

success:=iCal Remove calendar (calendar)

calendar (TEXT)

The calendar ID.

success (LONGINT)

1 for success, 0 for failure.
  • Discussion
This command will attempt to remove a calendar.

iCal Set calendar property

success:=iCal Set calendar property (calendar; key; value)

calendar (TEXT)

The calendar ID.

key (TEXT)

The name of the property to set.

You can use a iCal Calendar Properties constant for key.

value (TEXT)

The new value for this property.

success (LONGINT)

1 for success, 0 for failure, or one of the following error codes; 1025 CalCalendarNotEditableError 1026 CalDateInvalidError 1027 CalCalendarNotInRepository 1028 CalCalendarTitleNotUniqueError The error text is also logged in the console.
  • Discussion
This command will attempt to update a property of a calendar and save it. Color values should be passed in textual form, which can be created with the iCal Make color command.

Calendar Store Commands

iCal GET CALENDAR LIST

iCal GET CALENDAR LIST (calendarIds; calendarNames)

calendarIds (ARRAY)

On return, an array of calendar IDs.

calendarNames (ARRAY)

On return, an array of calendar names.
  • Discussion
This command returns an array of all calendar IDs in the Calendar Store.

iCal QUERY EVENT

iCal QUERY EVENT (startDate; endDate; calendars; events)

startDate (TEXT)

A start date.

endDate (TEXT)

An end date.

calendars (ARRAY)

An array of calendar IDs.

events (ARRAY)

On return, an array of event IDs.
  • Discussion
This command returns an array of event IDs in the specified period.

iCal QUERY TASK

iCal QUERY TASK (dueDate; calendars; tasks)

dueDate (TEXT)

A due date.

calendars (ARRAY)

An array of calendar IDs.

tasks (ARRAY)

On return, an array of task IDs.
  • Discussion
This command returns an array of task IDs that are due before the specified date.

Type Cast Commands

iCal GET COLOR

iCal GET COLOR (color; red; green; blue; alpha)

color (TEXT)

The color XML.

red (REAL)

The red component of this color.

green (REAL)

The green component of this color.

blue (REAL)

The blue component of this color.

alpha (REAL)

The alpha component of this color.
  • Discussion
This command resolves the color expressed in XML property list and returns the red, green, blue and alpha components.

iCal GET DATE

iCal GET DATE (xml; date; time; offset)

xml (TEXT)

The composite time in XML.

date (DATE)

The date component.

time (TIME)

The time component.

offset (LONGINT)

The different to GMT in seconds.
  • Discussion
This command resolves the ISO time string and returns the date, time and offset seconds from GMT.

iCal Make color

color:=iCal Make color (red; green; blue; alpha)

red (REAL)

The red component value.

green (REAL)

The green component value.

blue (REAL)

The blue component value.

alpha (REAL)

The alpha component value.

color (TEXT)

The color XML.
  • Discussion
This command returns the color in XML property list format. The red, green, blue and alpha components are expressed in the range of 0.0 to 1.0.

iCal Make color from index

color:=iCal Make color from index (index)

index (LONGINT)

The color index, as used in 4D Chart, a value between 1 and 256.

color (TEXT)

The color XML.
  • Discussion
This command returns the color index in XML property list format.

iCal Make date

xml:=iCal Make date (date; time; timezone)

date (DATE)

The date component.

time (TIME)

The time component.

timezone (TEXT)

A timezone identifier, such as CET, JST, GMT, etc. Some verbose expressions are supported.

xml (TEXT)

The composite time in XML.
  • Discussion
This utility method returns the given time, date and timezone values in ISO format.

Recurrence Rule Commands

iCal Remove event recurrence

success:=iCal Remove event recurrence (event)

event (TEXT)

The event ID.

success (LONGINT)

1 for success, 0 for failure.
  • Discussion
This command removes the recurrence rule from an event.

iCal Set event recurrence

success:=iCal Set event recurrence (event; type; interval; date; param1; param2; param3)

event (TEXT)

The event ID.

type (TEXT)

The recurrence type.

You can use a iCal Recurrence Rules constant for type.

interval (LONGINT)

The recurrence interval.

date (TEXT)

The recurrence anchor date.

param1 (TEXT)

The interpretation of this argument depends on the context.

param2 (TEXT)

The interpretation of this argument depends on the context.

param3 (TEXT)

The interpretation of this argument depends on the context.

success (LONGINT)

1 for success, 0 for failure.
  • Discussion
This command sets the recurrence rule for an event. If successful, 1 is returned, otherwise 0. See CalRecurrenceRule for description of recurrence rules. If the type is Daily and the end date is omitted, the rule is set with the interval and no end date. If the type is Daily and the end date is specified, the rule is set with the interval and the end date. If the type is Weekly, the end date is omitted and param1 is omitted, the rule is set with the interval and no end date. If the type is Weekly, the end date is specified and param1 is omitted, the rule is set with the interval and the end date. If the type is Weekly, the end date is omitted and the day numbers (between 1-7) are passed in comma delimited form in param1, the rule is set with the interval, day numbers and no end date. If the type is Weekly, the end date is specified and the day numbers (between 1-7) are passed in comma delimited form in param1, the rule is set with the interval, day numbers and the end date. If the type is Monthly, the end date is omitted, param1 is omitted and param2 is omitted, the rule is set with the interval and no end date. If the type is Monthly, the end date is omitted, the day numbers (between 1-31) are passed in comma delimited form in param1 and param2 is omitted, the rule is set with the interval, day numbers and no end date. If the type is Monthly, the end date is omitted, the day numbers (between 1-7) are passed in comma delimited form in param1 and the week numbers (between 1-4 for -1 for the last week of month) are passed in comma delimited form in param1, the rule is set with the interval, day numbers, week numbers and no end date. If the type is Monthly, the end date is specified, param1 is omitted and param2 is omitted, the rule is set with the interval and the end date. If the type is Monthly, the end date is specified, the day numbers (between 1-31) are passed in comma delimited form in param1 and param2 is omitted, the rule is set with the interval, day numbers and the end date. If the type is Monthly, the end date is specified, the day numbers (between 1-7) are passed in comma delimited form in param1 and the week numbers (between 1-4 for -1 for the last week of month) are passed in comma delimited form in param1, the rule is set with the interval, day numbers, week numbers and the end date. If the type is Yearly, the end date is omitted, param1 is omitted, param2 is omitted and param3 is omitted, the rule is set with the interval and no end date. If the type is Yearly, the end date is omitted, the month numbers (between 1-12) are passed in comma delimited form in param1, param2 is omitted and param3 is omitted, the rule is set with the interval, month numbers and no end date. If the type is Yearly, the end date is omitted, the month numbers (between 1-12) are passed in comma delimited form in param1, week numbers (between 1-4 for -1 for the last week of month) are passed in comma delimited form in param2 and month numbers (between 1-12) are passed in comma delimited form in param3, the rule is set with the interval, day numbers, week numbers, month numbers and no end date. If the type is Yearly, the end date is specified, param1 is omitted, param2 is omitted and param3 is omitted, the rule is set with the interval and the end date. If the type is Yearly, the end date is specified, the month numbers (between 1-12) are passed in comma delimited form in param1, param2 is omitted and param3 is omitted, the rule is set with the interval, month numbers and the end date. If the type is Yearly, the end date is specified, the month numbers (between 1-12) are passed in comma delimited form in param1, week numbers (between 1-4 for -1 for the last week of month) are passed in comma delimited form in param2 and month numbers (between 1-12) are passed in comma delimited form in param3, the rule is set with the interval, day numbers, week numbers, month numbers and the end date.

Alarm Commands

iCal Add alarm to event

success:=iCal Add alarm to event (event; alarm)

event (TEXT)

The event ID.

alarm (TEXT)

The alarm XML.

success (LONGINT)

1 for success, 0 for failure, or one of the following error codes; 1025 CalCalendarNotEditableError 1026 CalDateInvalidError 1027 CalCalendarNotInRepository 1028 CalCalendarTitleNotUniqueError The error text is also logged in the console.
  • Discussion
This command adds an alarm previously create with the iCal Make alarm command to an event.

iCal Add alarm to task

success:=iCal Add alarm to task (task; alarm)

task (TEXT)

The task ID.

alarm (TEXT)

The alarm XML.

success (LONGINT)

1 for success, 0 for failure, or one of the following error codes; 1025 CalCalendarNotEditableError 1026 CalDateInvalidError 1027 CalCalendarNotInRepository 1028 CalCalendarTitleNotUniqueError The error text is also logged in the console.
  • Discussion
This command adds an alarm previously create with the iCal Make alarm command to a task.

iCal Get alarm property

success:=iCal Get alarm property (alarm; key; value)

alarm (TEXT)

The alarm XML.

key (TEXT)

The property name to modify.

You can use a iCal Alarm Properties constant for key.

value (TEXT)

The new value for this property.

success (LONGINT)

1 for success, 0 for failure.
  • Discussion
This command will attempt to read a property of an alarm. If successful, 1 is returned, otherwise 0. It will fail, for example, if the property name is invalid, or the alarm doesn't exist.

iCal Make alarm

alarm:=iCal Make alarm

alarm (TEXT)

The alarm XML.
  • Discussion
This command creates a new alarm, saves it, and returns its properties in XML format.

iCal Set alarm property

success:=iCal Set alarm property (alarm; key; value)

alarm (TEXT)

The alarm XML.

key (TEXT)

The property name to modify.

You can use a iCal Alarm Properties constant for key.

value (TEXT)

The new value for this property.

success (LONGINT)

1 for success, 0 for failure.
  • Discussion
This command will attempt to update a property of an alarm and save it. If successful, 1 is returned, otherwise 0. Date values should be passed in textual form, which can be created with the iCal Make date command.

Application Commands

iCal LAUNCH

iCal LAUNCH

  • Discussion
This command launches the iCal application if it is not already running.

iCal TERMINATE

iCal TERMINATE

  • Discussion
This command terminates the iCal application if it is running.

iCal Direct Commands

iCal SET VIEW

iCal SET VIEW (view)

view (LONGINT)

The type of view.

You can use a iCal View Modes constant for view.

  • Discussion
This command asks the iCal appliation to switch perspective.

iCal SHOW DATE

iCal SHOW DATE (date)

date (DATE)

The date to show.
  • Discussion
This command asks the iCal appliation to highlight the specified date.

iCal SHOW EVENT

iCal SHOW EVENT (event)

event (TEXT)

The ID of the event to show.
  • Discussion
This command asks the iCal appliation to show the specified event.

iCal SHOW TASK

iCal SHOW TASK (task)

task (TEXT)

The ID of the task to show.
  • Discussion
This command asks the iCal appliation to show the specified task.

iCal app Get event property

success:=iCal app Get event property (event; key; value)

event (TEXT)

The event ID.

key (TEXT)

The name of the property to get.

You can use a iCal App Event Properties constant for key.

value (TEXT)

The value for this property.

success (LONGINT)

1 for success, 0 for failure.
  • Discussion
This command asks the iCal appliation to read a specific event property.

iCal app Get task property

success:=iCal app Get task property (task; key; value)

task (TEXT)

The task ID.

key (TEXT)

The name of the property to get.

You can use a iCal App Task Properties constant for key.

value (TEXT)

The value for this property.

success (LONGINT)

1 for success, 0 for failure.
  • Discussion
This command asks the iCal appliation to read a specific task property.

Notification Commands

iCal Get notification method

success:=iCal Get notification method (method)

method (TEXT)

The method name.

success (LONGINT)

1 for success, 0 for failure.
  • Discussion

iCal Set notification method

success:=iCal Set notification method (method)

method (TEXT)

The method name.

success (LONGINT)

1 for success, 0 for failure.
  • Discussion

Alarm II Commands

iCal Count event alarms

success:=iCal Count event alarms (event; count)

event (TEXT)

The event ID.

count (LONGINT)

The number of alarms.

success (LONGINT)

1 for success, 0 for failure.
  • Discussion

iCal Count task alarms

success:=iCal Count task alarms (task; count)

task (TEXT)

The task ID.

count (LONGINT)

The number of alarms.

success (LONGINT)

1 for success, 0 for failure.
  • Discussion

iCal Get event alarm

success:=iCal Get event alarm (event; index; alarm)

event (TEXT)

The event ID.

index (LONGINT)

The alarm number, counting from 1.

alarm (TEXT)

The alarm data, in XML.

success (LONGINT)

1 for success, 0 for failure.
  • Discussion

iCal Get task alarm

success:=iCal Get task alarm (task; index; alarm)

task (TEXT)

The task ID.

index (LONGINT)

The alarm number, counting from 1.

alarm (TEXT)

success (LONGINT)

1 for success, 0 for failure.
  • Discussion

iCal Remove event alarm

success:=iCal Remove event alarm (event; index)

event (TEXT)

The event ID.

index (LONGINT)

The alarm number, counting from 1.

success (LONGINT)

1 for success, 0 for failure.
  • Discussion

iCal Remove task alarm

success:=iCal Remove task alarm (task; index)

task (TEXT)

The task ID.

index (LONGINT)

The alarm number, counting from 1.

success (LONGINT)

1 for success, 0 for failure.
  • Discussion

iCal Set event alarm

success:=iCal Set event alarm (event; index; alarm)

event (TEXT)

The event ID.

index (LONGINT)

The alarm number, counting from 1.

alarm (TEXT)

The alarm data, in XML.

success (LONGINT)

1 for success, 0 for failure.
  • Discussion

iCal Set task alarm

success:=iCal Set task alarm (task; index; alarm)

task (TEXT)

The task ID.

index (LONGINT)

The alarm number, counting from 1.

alarm (TEXT)

The alarm data, in XML.

success (LONGINT)

1 for success, 0 for failure.
  • Discussion

iCal Event Properties Constants

Event attendees (attendees)

Event calendar (calendar)

Event dateStamp (dateStamp)

Event endDate (endDate)

Event hasAlarm (hasAlarm)

Event isAllDay (isAllDay)

Event isDetached (isDetached)

Event location (location)

Event nextAlarmDate (nextAlarmDate)

Event notes (notes)

Event occurrence (occurrence)

Event startDate (startDate)

Event title (title)

Event url (url)

iCal Calendar Properties Constants

Calendar color (color)

Calendar isEditable (isEditable)

Calendar notes (notes)

Calendar title (title)

Calendar type (type)

iCal Task Properties Constants

Task calendar (calendar)

Task completedDate (completedDate)

Task dateStamp (dateStamp)

Task dueDate (dueDate)

Task isCompleted (isCompleted)

Task priority (priority)

Task title (title)

Task url (url)

iCal Alarm Properties Constants

Alarm absoluteTrigger (absoluteTrigger)

Alarm action (action)

Alarm emailAddress (emailAddress)

Alarm relativeTrigger (relativeTrigger)

Alarm sound (sound)

Alarm url (url)

iCal Recurrence Rules Constants

Recurrence Daily (Daily)

Recurrence Monthly (Monthly)

Recurrence Weekly (Weekly)

iCal View Modes Constants

Day View (0)

Week View (1)

Month View (2)

iCal App Event Properties Constants

Event stamp date (dateStamp)

Event end date (endDate)

Event allday event (isAllDay)

Event location (location)

Event description (notes)

Event recurrence (recurrence)

Event sequence (sequence)

Event start date (startDate)

Event status (status)

Event summary (title)

Event url (url)

iCal App Task Properties Constants

Task completion date (completedDate)

Task due date (dueDate)

Task description (notes)

Task priority (priority)

Task sequence (sequence)

Task stamp date (stampDate)

Task summary (title)

Task url (url)

iCal Notification Types Constants

Calendar Notification (Calendar Notification)

Event Notification (Event Notification)

Task Notification (Task Notification)