[Tcladdressbook-commits] Help TclAB_QuickStart.html,NONE,1.1
Status: Alpha
Brought to you by:
bdesgraupes
|
From: <bde...@us...> - 2003-12-16 08:57:19
|
Update of /cvsroot/tcladdressbook/Help In directory sc8-pr-cvs1:/tmp/cvs-serv13008/Help Added Files: TclAB_QuickStart.html Log Message: First checkin --- NEW FILE: TclAB_QuickStart.html --- <HTML> <HEAD> <TITLE>TclAB_QuickStart</TITLE> <META NAME=GENERATOR CONTENT="Aida Mode"> </HEAD> <BODY> <!-- :Title: TclAB_QuickStart --> <!-- :Project: addressbook extension for Tcl --> <!-- :Version: $Revision: 1.1 $ --> <!-- :CVSDate: $Date: 2003/12/16 08:57:16 $ --> <!-- :Author: Bernard Desgraupes <A HREF="mailto:bde...@ea...">bde...@ea...</A> --> <!-- :Homepage: <A HREF="http://webperso.easyconnect.fr/bdesgraupes/">http://webperso.easyconnect.fr/bdesgraupes/</A> --> <!-- :Created: 2003-12-14 18:26:47 --> <!-- :Modified: 2003-12-14 18:26:52 --> <!-- :Keywords: Address book, data base --><P><!-- logo --> <P><IMG SRC="Images/TclAB_logo.gif " ALT="TclAB Logo" ALIGN=bottom></P> <P> <A href="TclAB.html"> Home Page</A> | <A href="http://sourceforge.net/projects/tcladdressbook"> Project Page at SourceForge</A><P><HR><BLOCKQUOTE><P><I> This file is a tutorial that demonstrates the [addressbook] command defined by the Tcladdressbook extension for Tcl. For a detailed and complete description of the syntax of each subcommand, refer to the help file: <UL> <LI> <A href="TclAddressBookHelp"> text format</A> <LI> <A href="TclAddressBookHelp.html"> HTML format</A><P></UL> </I></P></BLOCKQUOTE><HR> <UL> <LI><A HREF="#M1">Using the commands</A> <UL><LI><A HREF="#M2">The [groups] command</A></UL> <UL><LI><A HREF="#M3">The [persons] command</A></UL> <UL><LI><A HREF="#M4">The [count] command</A></UL> <UL><LI><A HREF="#M5">The [getme] command</A></UL> <UL><LI><A HREF="#M6">The [record] command</A></UL> <UL><LI><A HREF="#M7">The [type] command</A></UL> <UL><LI><A HREF="#M8">The [property names] command</A></UL> <UL><LI><A HREF="#M9">The [remove] command</A></UL> <UL><LI><A HREF="#M10">The [parents] command</A></UL> <UL><LI><A HREF="#M11">The [create] command</A></UL> <UL><LI><A HREF="#M12">The [property add] command</A></UL> <UL><LI><A HREF="#M13">The [property remove] command</A></UL> <UL><LI><A HREF="#M14">The [export] command</A></UL> <UL><LI><A HREF="#M15">The [import] command</A></UL> <UL><LI><A HREF="#M16">The [image] command</A></UL> <UL><LI><A HREF="#M17">The [set] command</A></UL> <UL><LI><A HREF="#M18">The [search] command</A></UL> <LI><A HREF="#M19">Using keyed lists</A> </UL><P>Load the extension <PRE> package require addressbook </PRE><P><H2><A NAME="M1"></A> Using the commands</H2> <H3><A NAME="M2"></A> The [groups] command</H3> List the groups (name and ID) <PRE> addressbook groups </PRE> List the groups (only ID) <PRE> addressbook groups -ids </PRE> List the subgroups of a specific group (name and ID) <PRE> set groupid [lindex [addressbook groups -ids] 2] addressbook groups -ingroup $groupid </PRE> List the subgroups of a specific group (only ID) <PRE> addressbook groups -ids -ingroup $groupid </PRE><P><H3><A NAME="M3"></A> The [persons] command</H3> List the person records (name and ID) <PRE> addressbook persons </PRE> List the person records (only ID) <PRE> addressbook persons -ids </PRE><P><H3><A NAME="M4"></A> The [count] command</H3> Count the existing groups and person records <PRE> addressbook count -groups addressbook count -persons addressbook count -persons -ingroup [lindex [addressbook groups -ids] 0] </PRE><P><H3><A NAME="M5"></A> The [getme] command</H3> Store the info about "me" in the variable myrecord. <PRE> set myrecord [addressbook getme] </PRE> The value of myrecord is a keyed list. One can use the usual Tcl list commands or the special keylist commands defined in the TclX extension like this: <PRE> keylkeys myrecord keylget myrecord Email.work keylget myrecord Address.home.ZIP clock format [keylget myrecord Birthday] </PRE><P><H3><A NAME="M6"></A> The [record] command</H3> Store the ID of the first record in the variable theid <PRE> set theid [lindex [addressbook persons -ids] 0] </PRE> Store the info about this record in the variable "person". The syntax is the same as with the [getme] command. <PRE> set person [addressbook record $theid] keylkeys person keylget person Email.work keylget person Address.home.ZIP clock format [keylget person Birthday] </PRE><P>Store the ID of the first group in the variable theid <PRE> set theid [lindex [addressbook groups -ids] 0] </PRE> Store the info about this group in the variable grp and display the results with the [parray] command <PRE> set grp [addressbook record $theid] keylkeys grp keylget grp GroupName clock format [keylget grp Modification] </PRE><P><H3><A NAME="M7"></A> The [type] command</H3> Find the type (ABPerson or ABGroup) of the object corresponding to the ID $theid <PRE> addressbook type $theid </PRE><P><H3><A NAME="M8"></A> The [property names] command</H3> Get the list of all existing properties for groups or persons <PRE> addressbook property names -groups addressbook property names -persons </PRE><P><H3><A NAME="M9"></A> The [remove] command</H3> Remove the record corresponding to the ID $theid from the database <PRE> addressbook delete $theid </PRE> Check that there were changes (1 if yes, 0 if no) <PRE> addressbook changed </PRE> Save the changes to make them permanent <PRE> addressbook save </PRE><P>Remove the record corresponding to the ID $theid from a specific group: it is removed as member of this subgroup but will be removed from the database only if it does not belong to other groups. <PRE> set groupid [lindex [addressbook groups -ids] 0] set theid [lindex [addressbook persons -ids] 0] addressbook delete $theid -fromgroup $groupid </PRE><P><H3><A NAME="M10"></A> The [parents] command</H3> List the parents of a person record (the various groups it belongs to). One can also find the parents of a group with this command. <PRE> set theid [lindex [addressbook persons -ids] 0] addressbook parents $theid </PRE> List the parents of a person record (only ID) <PRE> addressbook parents -ids $theid </PRE><P><H3><A NAME="M11"></A> The [create] command</H3> (group|person)<P><H3><A NAME="M12"></A> The [property add] command</H3> Add a new property of type String called Instrument <PRE> addressbook property add -persons Instrument String </PRE><P>Add a new property of type Date called Meeting <PRE> addressbook property add -groups Meeting Date </PRE><P><H3><A NAME="M13"></A> The [property remove] command</H3> Remove the properties created above <PRE> addressbook property remove -persons Instrument addressbook property remove -groups Meeting </PRE><P><H3><A NAME="M14"></A> The [export] command</H3> Create a VCard corresponding to a particular record. <PRE> set theid [lindex [addressbook persons -ids] 0] </PRE> The data returned is binary. You can store it in a file. <PRE> set vcardData [addressbook export $theid] </PRE><P><H3><A NAME="M15"></A> The [import] command</H3> <PRE> set fname [file join /Users bernardo someVcard.vcf] set fid [open $fname r] set vcard [read $fid] close $fid addressbook import $vcard </PRE><P><H3><A NAME="M16"></A> The [image] command</H3> <PRE> set theid [lindex [addressbook persons -ids] 0] set img [addressbook image $theid] </PRE><P><H3><A NAME="M17"></A> The [set] command</H3> set theid [lindex [addressbook persons -ids] 0] addressbook set $theid First<P>addressbook set $theid First Georgios addressbook changed addressbook save<P>addressbook set $theid First Jean-Sebastien <!-- multi string value --> addressbook set $theid Email {{Travail wo...@cl...} {Concerts DD...@su...}} addressbook set $theid Email {{Travail op...@or...} {Concerts BW...@CA...}}<P><!-- date value --> addressbook set $theid Birthday [clock scan "1 Apr 1985"]<P><!-- multi date value --> addressbook set $theid ABDate addressbook set $theid ABDate [list [list "anniv droopy" 621507600] [list "anniv doudou" 816592400] [list "anniv zozo" 621597600] [list "anniv fifi" 816692400]]<P><!-- multi dictionary value --> addressbook set $theid Address addressbook set $theid Address [list [list Home [list {CountryCode fr} {City Paris} {Country France} {ZIP 75010} {Street "184, rue du Faubourg Saint-Denis"}] ] ]<P><H3><A NAME="M18"></A> The [search] command</H3> <PRE> addressbook search -persons -ids -nocase Last == "bla" addressbook search -persons -ids -nocase Last > "Ba" </PRE><P><PRE> addressbook search -persons -nocase Modification >= 1070199949 addressbook search -persons -nocase Modification < 1070199949 </PRE><P><H2><A NAME="M19"></A> Using keyed lists</H2> <PRE> package require tclx </PRE><P>Last modification $Date: 2003/12/16 08:57:16 $ </BODY> </HTML> |