Paul BerkowitzPeter Wait

> On 7/21/02 8:32 PM, "Peter Wait" <[EMAIL PROTECTED]> wrote:
> 
>> Paul BerkowitzPeter Wait
>> 
>>> On 7/20/02 3:22 PM, "Jan Martel" <[EMAIL PROTECTED]> wrote:
>>> 
>>>> This is a continuation of my effort to get the multi-day events to work
>>>> acceptable between E'rage and Palm. I want to categorize multi-day events
>>>> on
>>>> E'rage as no sync. I thought the easiest way to do that would be to make a
>>>> custom view of multi day events. But that didn't seem to be possible. The
>>>> things that could be specified in custom view didn't seem to include
>>>> anything that would get me multi-day events. Am I missing something? If
>>>> not,
>>>> is there some other way to find multi-day events other than searching
>>>> through the calendar?
>>> 
>>> AppleScript. You can't do it in the UI. Time to learn a bit of AppleScript,
>>> Jan.
>>> 
>>> ------------------------------------------
>>> 
>>> tell application "Microsoft Entourage"
>>>   set noSync to category "No Sync"
>>>   set allDays to every event where its all day event is true
>>>   repeat with i from 1 to (count my allDays)
>>>       set anAllDay to item i of my allDays
>>>       tell anAllDay
>>>           if ((its end time) - (get its start time) > (1 * days)) then
>>>               set cats to its category
>>>               if cats does not contain {noSync} then
>>>                   set its category to (cats & {noSync})
>>>               end if
>>>           end if
>>>       end tell
>>>   end repeat
>>> end tell
>>> 
>>> --------------------------------
>>> 
>>> This also makes sure you don't keep adding on "extra" No Sync categories
>>> each time you run the script.
>> Using the above as a basis, I created the following AppleScript:
>> 
>> tell application "Microsoft Entourage"
>>   set nbsp to every contact whose spouse contains (not null)
> 
> 1) 'spouse' property is a string. Even if it it's empty, it's not null, it's
> "". 
>   
>    set nbsp to every contact whose spouse � ""
> 
> will work.
> 
>>   repeat with c in nbsp
> 
> 2) A little dangerous to use that type of repeat loop. There are many places
> in Entourage where it won't work for equality comparisons, since there the
> exact evaluation of c is 'item  1 of {contact id 6, contact id 9, contact id
> 17�}'. You either need to say 'contents of' or use this type of repeat loop,
> which is safer:
> 
>   repeat with i from 1 to (count nbsp)
>       set c to item i of nbsp
> 
>>       set custom field one to spouse
> 
> 3). Nope, can't do that. Like all AppeScript Entourage has its own object
> model. the custom fiels one doesn't belong to teh application, it belongs to
> the contact (c).  Plus (4) you have to do the same thing with 'spouse' , and
> evaluate it first by an explicit get or by a dirsct 'tell'. So you either
> have to do:
> 
>   set custom field of c to (get spouse of c)
> 
> or 
> 
>   tell c to set its custom field one to its spouse
> 
> 
>>   end repeat
>> end tell
>> 
>> And I get the error: "Descriptor type Mismatch"
>> 
>> When I simplify it to:
>> 
>> tell application "Microsoft Entourage"
>>   repeat
>>       set custom field one to spouse
>>   end repeat
>> end tell
>> 
>> And I get the error: "Custom field One Can't Be Set to Spouse"
>> 
>> I know its something basic I'm missing, but is anyone willing to tell me how
>> to correct this script to get Custom field One set to Spouse?
>> 
>> Thanks,
>> 
>>   Peter Wait
> See above (also do something about your strange attribution line ;-)).
>> 
> 
> tell application "Microsoft Entourage"
>   set nbsp to every contact whose spouse � ""
>  repeat with i from 1 to (count nbsp)
>       set c to item i of nbsp
>       tell c to set its custom field one to its spouse
>   end repeat
> end tell

I received this Script from Paul; I'll paste a copy of the script I executed
here:

tell application "Microsoft Entourage"
    set nbsp to every contact whose spouse � ""
    repeat with i from 1 to (count nbsp)
        set c to item i of nbsp
        tell c to set its custom field one to its spouse
    end repeat
end tell

I then tested it in AppleScript, and it ran fine. So I moved it to the
Entourage Script folder. I then selected it from the Script menu and
executed it. The hard drive made the sound it makes when its doing
something, and then this stopped. So it seemed to execute. But when I look
at my data, none of my Custom One Fields contain the spouse; they are all
still blank as they were.

I must have left out something basic; anything come to mind.

Thanks,
    Peter


--
To unsubscribe:                     <mailto:[EMAIL PROTECTED]>
archives:       <http://www.mail-archive.com/entourage-talk%40lists.letterrip.com/>
old-archive:       <http://www.mail-archive.com/entourage-talk%40lists.boingo.com/>

Reply via email to