Re: Palm Desktop 4.1 (creating a memo)
Re: Palm Desktop 4.1 (creating a memo)
- Subject: Re: Palm Desktop 4.1 (creating a memo)
- From: Paul Berkowitz <email@hidden>
- Date: Wed, 30 Apr 2003 20:38:03 -0700
On 4/30/03 7:11 PM, "Chris Page" <email@hidden> wrote:
>
On Wednesday, Apr 30, 2003, at 07:20 US/Pacific, Brennan wrote:
>
>
> Chris, I'm seeing problems whe I try to set the contents of a memo.
>
>
>
> tell application "Palm Desktop"
>
> tell (make memo)
>
> set title to "test"
>
> set contents to "this is cool" -- error here
>
> end tell
>
> end tell
>
>
A little consultation over on the applescript-implementers list
>
revealed that this is a little confusing, but not a bug. You need to
>
change your script to:
>
>
set contents of contents to "this is cool"
>
>
When you use the result of 'make memo', you're working with a reference
>
to the memo. When you ask for the contents of a reference, you get the
>
object it refers to. So your version of the script means:
>
>
set memo id 42 to "this is cool"
>
>
Adding another 'contents of' changes this to:
>
>
set contents of memo id 42 to "this is cool"
>
>
You'll see the same behavior if you assign the reference to the memo to
>
a variable:
>
>
set m to make memo
>
set contents of m to "this is cool" -- error here
>
>
set contents of contents of m to "this is coo" -- works
>
>
It seems AppleScript automatically gets the contents of the reference
>
when you ask for some property other than 'contents'.
>
>
I thought using the generic 'contents' property would simplify things,
>
but it seems that this creates a potentially confusing experience,
>
since it's different from other properties.
The confusion comes largely from Brennan trying to save one line by writing
tell (make memo)
if he simply does what everyone else does:
set newMemo to make new memo
tell newMemo
--etc.
there won't be any confusion, and no need for 'contents of contents'. There
are lots of apps that use 'contents' as a property of some class or another.
You did fine. It's anyone's prerogative to 'tell' a command, as above, but
then you deserve what you get (having to type 'contents of contents').
--
Paul Berkowitz
_______________________________________________
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.