Sending raw Apple Events to Palm Desktop
Sending raw Apple Events to Palm Desktop
- Subject: Sending raw Apple Events to Palm Desktop
- From: "Anthony Adachi" <email@hidden>
- Date: Tue, 25 May 2010 09:07:00 -0400
Hello all,
I've encountered an issue scripting Palm Desktop for the Mac with the
whose clause on attached files and am trying to find a workaround.
I'm scripting some functionality which at some point looks for linked
(attached) files to a particular Event, To Do, Address, or Memo item.
While it's possible to use a repeat loop to identify build a list of the
attached files I was hoping there was a way to use a whose clause to do this.
Some Background Info
---------------------------
Palm Desktop identifies attached files as class alias. Making comparison/
conditional checks on an individual basis (e.g. 'class of x is alias')
works but not in a whose clause.
For example, this works (assuming a selected Palm record's, fifth
attached item is a file)...
'tell application "Palm Desktop"
set selected to selection
set anOrganizer_rec to item 1 of selected
tell anOrganizer_rec
set all_attachments to attachments
set attached_item to item 5 of all_attachments
class of attached_item is alias
--> true
if (the class of attached_item is alias) then
say "doing stuff, as one might do in a repeat loop."
end if
end tell
end tell'
The Issue
------------
The following whose clause syntax works on attached items that are
standard Palm records, like Memos or Addresses for instance...
'set just_memos to attachments where class of it is memo'
While this doesn't, as it returns an empty list.
'set just_files to attachments where class of it is alias'
To make a long story short, it seems there may be an issue with Palm
Desktop's whose clause when it comes to identifying attached files.
Asking for 'class of attachments' yields interesting results. The follow
results are from a test Event with 5 attachments, including one file...
--> {memo, address, address, address, «class CATF»}
Although, trying to make a check using the raw Apple Event code for the
class that appeared earlier doesn't work.
' set raw_code_truth to class of item 5 of all_attachments is «class CATF»
--> false'
Workarounds?
-----------------
Perhaps, a implementing a workaround which uses a whole whose clause
message in raw form might be successful? Though, with regards to using
"raw syntax to enter and execute events" the AppleScript Language Guide
says it's "...beyond the scope of this guide...." and thus isn't
particularly helpful on this matter.
How can one send a whole whose clause message to an application as an
raw apple event within AppleScript?
Where can I find out more information about doing so?
Or perhaps, more to the heart of the matter, might sending raw events be
a direction worth pursuing or likely a dark rabbit hole from whence one
might never return?
In which case, might it be best to implement a workaround involving what
the items are not? Such as something along the lines of this...
'set filtered_4 to attachments where class of it is not memo and class
of it is not address and class of it is not to do and class of it is not event
--> one item left, the file (alias)'
Some more code which further illustrates the issue follows....
--- start of code illustrating the issue. ---
------------------------------------------------
-- assuming a test event with one attachted memo, 3 attached addresses
and one attached file for a total of 5 items.
-- item 5 is the attached file.
tell application "Palm Desktop"
set selected to selection
set anOrganizer_rec to item 1 of selected
tell anOrganizer_rec
set all_attachments to attachments
--> a list of 5 items, as expected.
set aFile to item 5 of all_attachments
set file_identifier to class of aFile
--> alias <-- Palm identifies attached files as class alias.
set just_memos to attachments where class of it is memo
--> list of 1 item, as expected.
set just_contacts to attachments where class of it is address
--> list of 3 items, as expected.
set just_files to attachments where class of it is alias
--> '{}' , a list of zero items (can't seem to identiy a file in a
whose clause using class alias)
set isClass_alias to class of item 5 of all_attachments is alias
--> true, as expected.
set all_classes to class of attachments
--> a list of 5 items, where item 5 (the file) is '«class CATF»'.
set raw_code_truth to class of item 5 of all_attachments is «class CATF»
--> false
end tell
end tell
--- end of code illustrating the issue. ---
------------------------------------------------
Thanks,
Anthony
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden