[Adium-devl] Use of Applescript make commands

Evan Schoenberg evan.s at dreskin.net
Fri May 23 16:20:51 UTC 2008


On May 23, 2008, at 10:26 AM, Matt Handley <applmak at gmail.com> wrote:

> Oh, you're quite close. The correct 1.3svn syntax is:
>
> tell application "Adium"
> 	tell account "applmak"
> 		set c to make new contact with properties {name:"123456789"}
> 	end tell
> end tell
>

Thanks.
> I don't think making a reference to am undefined contact should (or  
> could) add that contact.
It shouldn't, I agree. However, there should be no such thing as an  
undefined contact.

I noticed that the "make contact" code puts the contact in the root  
contact list if no group is specified. That's not the right behavior -  
and the same problem, probably resulting from underdocumentation, is  
reflected in your idea here.

We can create an AIListContact - and must, to talk to someone or  
manipulate their information - independent of its presence on the  
contact list or a particular group. For a concrete example, select New  
Chat... In the file menu and type in a stranger's name. A chat is  
opened with a new AIListContact, but no contact list changes are made.  
[contact isStranger] returns YES in that situation.

Does that clarify what I meant at all?


> However, I think I can change things so that contact names, rather  
> than references, can be used. So the following would become  
> syntactically correct:
>
> make new chat with contacts {"123456789"} with new chat window
>
> I think that should appease scripters.
>
I do think that would be easier :)

Cheers,
Evan


> Matt
>
> On May 23, 2008, at 6:16 AM, Evan Schoenberg wrote:
>
>> http://trac.adiumx.com/ticket/9879 points out that the address book  
>> scripts are broken with the new applescript implementation.
>>
>> The SMS one has an obvious initial problem - screenName was copied  
>> from another script and should actually be phoneNumber.
>>
>> However, fixing this to
>>
>> tell first account of service "AIM"
>> 	make new chat with contacts {contact phoneNumber} with new chat  
>> window
>> end tell
>>
>> only works if a contact with the UID phoneNumber on the first  
>> account already exists. Otherwise, we get a nil contact and  
>> everything goes poorly.  Could looking up a contact by UID be made  
>> to create the contact if it doesn't exist?
>>
>> Furthermore, I tried to make a new contact, but I can't figure out  
>> the syntax. The following:
>>
>> 				tell first account of service "AIM"
>> 					set myContact to make new contact with properties  
>> {UID:phoneNumber}
>> 					make new chat with contacts {myContact} with new chat window
>> 				end tell
>> gives:
>> 2008-05-23 07:09:35.403 Adium[35494:10b] Error converting apple  
>> event to script command: -1700
>> 2008-05-23 07:09:35.404 Adium[35494:10b]     Original event:  
>> <NSAppleEventDescriptor: 'core'\'crel'{ 'kocl':'Ccnt', 'prdt': 
>> { 'usrf':[ "uid", 'utxt'("+12412445469") ] }, &'subj':'obj  
>> '{ 'form':'indx', 'want':'Cact', 'seld':1, 'from':'obj  
>> '{ 'form':'name', 'want':'Csrv', 'seld':'utxt'("AIM"),  
>> 'from':'null'() } }, &'csig':65536 }>
>> 2008-05-23 07:09:35.405 Adium[35494:10b]     Offending object  
>> descriptor: <NSAppleEventDescriptor: { 'usrf':[ "uid", 'utxt'("+12412445469 
>> ") ] }>
>> 2008-05-23 07:09:35.406 Adium[35494:10b]     Expected type  
>> descriptor: <NSAppleEventDescriptor: 'obj '{ 'from':'Ccnt',  
>> 'form':'prop', 'seld':'pALL', 'want':'prop' }>
>>
>>
>> Help! :)
>>
>> Cheers,
>> Evan
>> _______________________________________________
>> Adium-devl mailing list
>> Adium-devl at adiumx.com
>> http://adiumx.com/mailman/listinfo/adium-devl_adiumx.com
>
> div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px;  
> margin-left: 0px; ">http://adiumx.com/mailman/listinfo/adium-devl_adiumx.com
> _______________________________________________
> Adium-devl mailing list
> Adium-devl at adiumx.com
> http://adiumx.com/mailman/listinfo/adium-devl_adiumx.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://adium.im/pipermail/devel_adium.im/attachments/20080523/e13ce9ac/attachment-0001.html>


More information about the devel mailing list