[futurebasic] Re: [FB] Apple address book

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 2006 : Group Archive : Group : All Groups

From: Steve Crossman <mactech@...>
Date: Fri, 20 Jan 2006 20:23:21 -0500
I deselected the contact in my address book  [ it was my mother ]
clicked on another name and now this script works, but it always  
returns my mother's name, but she isn't first in the list.

On Jan 20, 2006, at 6:35 PM, Ken Shmidheiser wrote:

> Alain wrote:
>
>> I get the same result as Doug.
>
> Alain,
>
> Are you using Tiger or Panther? I'm in Panther here so I have no  
> way to test in Tiger. Here is the source AppleScript I wrote to  
> give you a basis for experimentation. Could you run this through  
> AppleScript Studio or Script Editor and see if it works. This  
> should return the name, address and phone number of the first  
> person in your AddressBook.
>
>
> tell application "Address Book"
> 	set info to ""
> 	set temp to properties of person 1
> 	set addr to properties of address 1 of person 1
> 	set the phon to the value of phone 1 of person 1
> 	set info to name of temp
> 	set info to info & return & street of addr
> 	set info to info & return & city of addr
> 	set info to info & ", " & state of addr
> 	set info to info & " " & zip of addr
> 	set info to info & return & phon
> 	return info
> end tell
>
>
> Also, if you would, try this modified code and see if it returns a  
> single record.
>
> Thanks again,
>
> Ken
>
> include "Subs AppleScript.Incl"
>
> clear local mode
> local fn GetAddressBookInfo$( who as long )
> dim as OSErr  err
> dim as str255 result
> dim as handle h
>
> route _toApplescript
> print "tell application ""Address Book"""
> print "set info to """"
> print "set temp to properties of person " + str$(who)
> print "set addr to properties of address 1 of person 1"
> print "set the phon to the value of phone 1 of person "¬
>                                            + str$(who)
> print "set info to name of temp"
> print "set info to info & return & street of addr"
> print "set info to info & return & city of addr"
> print "set info to info & "", "" & state of addr"
> print "set info to info & "" "" & zip of addr"
> print "set info to info & return & phon"
> print "return info"
> print "end tell"
> route _toScreen
>
> err = usr AppleScriptRun( result )
> long if (err == _noErr)
> h = Usr AppleScriptGetResult
> if h then disposeHandle(h)
> xelse
> result = str$( err )
> end if
>
> end fn = result
>
> window 1
>
> print fn GetAddressBookInfo$(1)
>
> include "Subs Quick Event Loop.Incl"
>
> --
>