Upcoming changes to Palm Desktop scripting (1 of 3)
Upcoming changes to Palm Desktop scripting (1 of 3)
- Subject: Upcoming changes to Palm Desktop scripting (1 of 3)
- From: Chris Page <email@hidden>
- Date: Sat, 19 Apr 2003 15:59:17 -0700
[Okay, I'm having a bad mail day. I split my long message into two
parts, but the list is complaining that the first part is still too
long, though it accepted the second part. So, I've split the first
message again, and this is now part 1 of 3, but part 2 went to the list
and is named "2 of 2".]
[I sent this message earlier, but it was put on hold by the list
because it exceeded the 8K length limit. I'm resending it in two parts.
This is part 1.]
I thought I'd take this opportunity to discuss some of the changes I've
implemented in the in-development version of Palm Desktop.
I cannot say when -- or, strictly speaking, if -- this will ship. I'll
refer to it as the "in-development version" or the "upcoming version",
or maybe even the "next version", and I may even use the term "now"
when referring to the current behavior of this as yet unreleased
version, but again I can't promise when or if this will ship. Although
I did a lot of the programming (all of the AppleScript changes, in
fact), I am not responsible for setting release schedules.
On Tuesday, Apr 15, 2003, at 01:05 US/Pacific, Richard Morton wrote:
I put some info about scripting PD here:
<http://home.netc.net.au/~sunreal/FooDooLounge/info/palm_desktop.html>
I took a look at this website and have some comments:
Create new address (contact)
...
make new address
--> {object class :+ class CONT;, object number :15 ,object instance
:-1 }
The record and its three properties represent the raw internal
representation of objects in Palm Desktop. This is an implementation
detail that should not have been exposed in AS. It may be possible to
corrupt data or cause Palm Desktop to crash if any of the properties
are set to an invalid value and sent to Palm Desktop. Anyway, it's
generally more appropriate to return a reference when an object is
created or requested. In the upcoming version I've eliminated these
properties and instead of records you'll see references for objects
everywhere, e.g.:
make new address
--> address id 42
object number is an internal object id. It does not appear to change,
so once you have it you could use it to call that object again.
Note, however, that these ids are not unique over the long term.
Although they are persistent for the lifetime of an object, if an
object is deleted its id may be reassigned to an object created later.
Furthermore, the object class and id properties can change when you may
not expect it: Internally Palm Desktop uses separate classes and ids to
represent repeating items and non-repeating items. So if you change an
event to repeating, the original internal object will be deleted and
its properties copied to a new repeating object with a new id. In the
UI, the user only sees one object. This is all just the details of how
the data is stored.
In the upcoming version, this detail is less visible from AppleScript.
Repeating and non-repeating items have the same AppleScript class,
although the id will still change if an item is changed between
repeating and non-repeating.
object instance is set to -1 unless it's a repeating to do or event.
For repeating items, object instance is the date of a particular
instance, expressed as the number of days since Jan 1, 1904. It is -1
for non-repeating items or for repeating items when you're referring to
every instance of the repeating item. If, for example, you set the
title of a repeating event with an instance of -1, then you'll set the
title for all instances, otherwise you'll only set the title on a
particular date. At least, that's how it works internally. I haven't
tried to do this via AppleScript.
Again, these are all internal details that shouldn't have been exposed.
You shouldn't rely on being able to manipulate these properties
directly. It's not guaranteed to work. At best, this information is
useful for debugging.
New memo (note) with initial data
Note that the data in the body will not necessarily be visible
immediately, though it is there - it can be got with AS and will
appear in the UI eventually.
I believe I've fixed all the drawing problems. Property changes should
now all be immediately reflected in the UI.
Also note that creating a memo or address used to open a window in the
UI and display the item. I've eliminated this behavior, so although any
visible windows should be updated to reflect changes made via
scripting, creating items no longer open windows.
make new memo with data {title:"Note for Foo", body:"Foo has a Bar"}
"with data" wasn't really the right term for Palm Desktop to use. I've
changed it to use "with properties" to specify properties for new
items. "with data" can be used with a string to create categories and
labels (in addition to using "with properties" explicitly), e.g.:
make new category with data "My Category"
--> category id 37
New event (appointment) with initial data
The date property accepts an AS date object. The duration is in
minutes.
The three separate 'date', 'start time', and 'end time' properties have
been deprecated in favor of just two 'start time' and 'end time'
properties. They must currently be set to the same year/month/day, or
an error will be returned, although you could imagine this easily being
extended to support events that span days (this is not a product
announcement).
The old representation was awkward: the old date property was the date
with the time set to midnight, and start/end time were dates on Jan 1,
1904. Even though the new 'start time' and 'end time' have the same
name as the old properties, they have new four-character codes and the
old terms have " OBSOLETE" suffixed onto them to make them stand out in
decompiled scripts. To aid in migration, the old properties may still
be read, but they are no longer writable.
In order to make date and time representations more consistent, I've
changed the duration to seconds. This means you can directly use the
difference between two dates as a duration, or to compare with a
duration. The resolution is still only whole minutes, however, so if
you set the duration to, say, 90 seconds, it will be rounded down to 60
seconds.
[continued in next message, marked "2 of 3"...]
--
Chris Page - Software Wrangler - Palm, Inc.
The most likely way for the world to be destroyed, most experts agree,
is by accident. That's where we come in; we're computer professionals.
We cause accidents. -- Nathaniel Borenstein
_______________________________________________
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.