[Tcladdressbook-commits] Help TclAB_QuickStart.html,1.11,1.12
Status: Alpha
Brought to you by:
bdesgraupes
|
From: Bernard D. <bde...@us...> - 2004-08-02 07:36:35
|
Update of /cvsroot/tcladdressbook/Help In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18183/Help Modified Files: TclAB_QuickStart.html Log Message: Reoredered the commands in tutorial Index: TclAB_QuickStart.html =================================================================== RCS file: /cvsroot/tcladdressbook/Help/TclAB_QuickStart.html,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- TclAB_QuickStart.html 1 Aug 2004 17:56:39 -0000 1.11 +++ TclAB_QuickStart.html 2 Aug 2004 07:36:26 -0000 1.12 @@ -9,7 +9,7 @@ <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. It documents -version 1.1b5. All the Tcl instructions in the sections +version 1.1. All the Tcl instructions in the sections below are very short one-line commands which you can try in any Tcl shell, like tclsh for instance. <P> For a detailed and complete description of the syntax of each subcommand, @@ -26,23 +26,29 @@ <UL><LI><A HREF="#M6">The [setme] subcommand</A></UL> <UL><LI><A HREF="#M7">The [record] subcommand</A></UL> <UL><LI><A HREF="#M8">The [type] subcommand</A></UL> -<UL><LI><A HREF="#M9">The [delete] subcommand</A></UL> -<UL><LI><A HREF="#M10">The [add] subcommand</A></UL> -<UL><LI><A HREF="#M11">The [remove] subcommand</A></UL> -<UL><LI><A HREF="#M12">The [parents] subcommand</A></UL> -<UL><LI><A HREF="#M13">The [create] subcommand</A></UL> -<UL><LI><A HREF="#M14">The [property names] subcommand</A></UL> -<UL><LI><A HREF="#M15">The [property type] subcommand</A></UL> -<UL><LI><A HREF="#M16">The [property add] subcommand</A></UL> -<UL><LI><A HREF="#M17">The [property remove] subcommand</A></UL> -<UL><LI><A HREF="#M18">The [export] subcommand</A></UL> -<UL><LI><A HREF="#M19">The [import] subcommand</A></UL> -<UL><LI><A HREF="#M20">The [image] subcommand</A></UL> -<UL><LI><A HREF="#M21">The [set] subcommand</A></UL> -<UL><LI><A HREF="#M22">The [search] subcommand</A></UL> -<UL><LI><A HREF="#M23">The [identifier] subcommand</A></UL> -<UL><LI><A HREF="#M24">The [label] subcommand</A></UL> -<LI><A HREF="#M25">Using keyed lists</A> +<UL><LI><A HREF="#M9">The [create] subcommand</A></UL> +<UL><LI><A HREF="#M10">The [delete] subcommand</A></UL> +<UL><LI><A HREF="#M11">The [add] subcommand</A></UL> +<UL><LI><A HREF="#M12">The [remove] subcommand</A></UL> +<UL><LI><A HREF="#M13">The [parents] subcommand</A></UL> +<UL><LI><A HREF="#M14">The [label] subcommand</A></UL> +<UL><LI><A HREF="#M15">The [set] subcommand</A></UL> +<UL><LI><A HREF="#M16">The [search] subcommand</A></UL> +<UL><LI><A HREF="#M17">The [property] subcommand</A></UL> +<UL><UL><LI><A HREF="#M18">The [property names] subcommand</A></UL></UL> +<UL><UL><LI><A HREF="#M19">The [property type] subcommand</A></UL></UL> +<UL><UL><LI><A HREF="#M20">The [property add] subcommand</A></UL></UL> +<UL><UL><LI><A HREF="#M21">The [property remove] subcommand</A></UL></UL> +<UL><LI><A HREF="#M22">The [identifier] subcommand</A></UL> +<UL><UL><LI><A HREF="#M23">The [identifier count] subcommand</A></UL></UL> +<UL><UL><LI><A HREF="#M24">The [identifier get] subcommand</A></UL></UL> +<UL><UL><LI><A HREF="#M25">The [identifier primary] subcommand</A></UL></UL> +<UL><UL><LI><A HREF="#M26">The [identifier set] subcommand</A></UL></UL> +<UL><UL><LI><A HREF="#M27">The [identifier index] subcommand</A></UL></UL> +<UL><LI><A HREF="#M28">The [export] subcommand</A></UL> +<UL><LI><A HREF="#M29">The [import] subcommand</A></UL> +<UL><LI><A HREF="#M30">The [image] subcommand</A></UL> +<LI><A HREF="#M31">Using keyed lists</A> </UL> First load the extension like this <PRE> @@ -118,7 +124,22 @@ to the ID <I>$theid</I> <PRE> addressbook type $theid -</PRE><P><H3><A NAME="M9"></A>The [delete] subcommand</H3> +</PRE><P><H3><A NAME="M9"></A>The [create] subcommand</H3> +One can create either a group's or a person's record. The third argument +will be the "name" of the new record, that is to say the name of the new +group or the last name of the new person respectively. The command returns +the unique ID of the created record. For instance: +<PRE> + addressbook create group WorkingCommittee + addressbook create person Beethoven +</PRE> +One can make them subgroups or members of an already existing group using +the <I>-ingroup</I> option: +<PRE> + set grpid [lindex [addressbook groups -ids] 0] + set subgrpid [addressbook create group Composers -ingroup $grpid] + addressbook create person Beethoven -ingroup $subgrpid +</PRE><P><H3><A NAME="M10"></A>The [delete] subcommand</H3> Remove from the database the record corresponding to the ID <I>$theid</I> <PRE> addressbook delete $theid @@ -130,7 +151,7 @@ Save the changes to make them permanent <PRE> addressbook save -</PRE><P><H3><A NAME="M10"></A>The [add] subcommand</H3> +</PRE><P><H3><A NAME="M11"></A>The [add] subcommand</H3> Add to a specific group the record corresponding to the ID <I>$theid</I>: this can be a person as well as a group (which would then become a subgroup of the group to which it is added). @@ -142,7 +163,7 @@ One can add several items at a time with this command: <PRE> addressbook add $groupid $theid1 $theid2 $theid3 -</PRE><P><H3><A NAME="M11"></A>The [remove] subcommand</H3> +</PRE><P><H3><A NAME="M12"></A>The [remove] subcommand</H3> Remove from a specific group the record corresponding to the ID <I>$theid</I>: this can be a person as well as a group. <PRE> @@ -153,7 +174,7 @@ One can remove several items at a time with this command: <PRE> addressbook remove $groupid $theid1 $theid2 $theid3 -</PRE><P><H3><A NAME="M12"></A>The [parents] subcommand</H3> +</PRE><P><H3><A NAME="M13"></A>The [parents] subcommand</H3> List the parents of a person record (the various groups it belongs to). <PRE> set theid [lindex [addressbook persons -ids] 0] @@ -162,78 +183,18 @@ List the parents of a person record (only ID) <PRE> addressbook parents -ids $theid -</PRE><P>One can also find the parents of a group using this command.<P><H3><A NAME="M13"></A>The [create] subcommand</H3> -One can create either a group's or a person's record. The third argument -will be the "name" of the new record, that is to say the name of the new -group or the last name of the new person respectively. The command returns -the unique ID of the created record. For instance: -<PRE> - addressbook create group WorkingCommittee - addressbook create person Beethoven -</PRE> -One can make them subgroups or members of an already existing group using -the <I>-ingroup</I> option: -<PRE> - set grpid [lindex [addressbook groups -ids] 0] - set subgrpid [addressbook create group Composers -ingroup $grpid] - addressbook create person Beethoven -ingroup $subgrpid -</PRE><P><H3><A NAME="M14"></A>The [property names] subcommand</H3> -Get the list of all existing properties for groups or for persons -<PRE> - addressbook property names -groups - addressbook property names -persons -</PRE><P><H3><A NAME="M15"></A>The [property type] subcommand</H3> -Get the type of a particular property -<PRE> - addressbook property type -groups UID - addressbook property type -persons Address -</PRE> -For the two examples above, the result is respectively -<I>String</I> and <I>MultiDictionary</I>.<P><H3><A NAME="M16"></A>The [property add] subcommand</H3> -Add a new person's property called <I>Instrument</I> with type <I>String</I> -<PRE> - addressbook property add -persons Instrument String -</PRE><P>Add a new group's property called <I>Meeting</I> with type <I>Date</I> -<PRE> - addressbook property add -groups Meeting Date -</PRE><P><H3><A NAME="M17"></A>The [property remove] subcommand</H3> -The third argument of this command can be either a record ID or the --persons and -groups keywords. If it is the former, the property is removed -from the specified record, otherwise it is removed from all the records of -this type and the return value is now the number of properties successfully -removed. +</PRE><P>One can also find the parents of a group using this command.<P><H3><A NAME="M14"></A>The [label] subcommand</H3> +Let's find the label of the first phone number for a record: <PRE> set theid [addressbook getme -id] - addressbook set $theid MaidenName Violet - addressbook save - addressbook property remove $theid MaidenName -</PRE><P>Remove the properties created above: -<PRE> - addressbook property remove -persons Instrument - addressbook property remove -groups Meeting -</PRE><P><H3><A NAME="M18"></A>The [export] subcommand</H3> -Create a VCard corresponding to a particular record: -<PRE> - set theid [lindex [addressbook persons -ids] 0] - set vcardData [addressbook export $theid] + addressbook label $theid Phone 0 </PRE> -The data returned is binary. You can store it in a file for instance.<P><H3><A NAME="M19"></A>The [import] subcommand</H3> -Import in the database some information stored in a .vcf file. A new -record containing this info, is created in the database: -<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="M20"></A>The [image] subcommand</H3> -Get the custom image corresponding to a particular record: +The returned string could be <I>Home</I> for instance. Let's change it to +<I>Personal</I>: <PRE> - set theid [lindex [addressbook persons -ids] 0] - set img [addressbook image $theid] -</PRE> -The data returned is binary. You can store it in a file for instance. -An error is raised if there is no custom image for this record.<P><H3><A NAME="M21"></A>The [set] subcommand</H3> + addressbook label $theid Phone 0 Personal + addressbook save +</PRE><P><H3><A NAME="M15"></A>The [set] subcommand</H3> This command lets you get or set the value of a particular field. For instance, to get the first name, dates and address fields of the first record: <PRE> @@ -270,7 +231,7 @@ <PRE> addressbook set $theid Address [list [list Home [list {CountryCode fr} {City Paris} {Country France} {ZIP 75001} {Street "1, avenue de l'Opéra"}]]] </PRE> -</UL><P><H3><A NAME="M22"></A>The [search] subcommand</H3> +</UL><P><H3><A NAME="M16"></A>The [search] subcommand</H3> This command can be used to report the IDs of the records corresponding to a single criterion. The criterion is expressed by a three elements list: the first element is the name of a property, the second is a comparison operator and @@ -313,10 +274,45 @@ <PRE> addressbook search -persons -nocase Address >= {"" {"" abc}} </PRE> -</UL><P><H3><A NAME="M23"></A>The [identifier] subcommand</H3> +</UL><P><H3><A NAME="M17"></A>The [property] subcommand</H3> +This command accepts four subcommands: names, type, add, and remove.<P><H4><A NAME="M18"></A>The [property names] subcommand</H4> +Get the list of all existing properties for groups or for persons +<PRE> + addressbook property names -groups + addressbook property names -persons +</PRE><P><H4><A NAME="M19"></A>The [property type] subcommand</H4> +Get the type of a particular property +<PRE> + addressbook property type -groups UID + addressbook property type -persons Address +</PRE> +For the two examples above, the result is respectively +<I>String</I> and <I>MultiDictionary</I>.<P><H4><A NAME="M20"></A>The [property add] subcommand</H4> +Add a new person's property called <I>Instrument</I> with type <I>String</I> +<PRE> + addressbook property add -persons Instrument String +</PRE><P>Add a new group's property called <I>Meeting</I> with type <I>Date</I> +<PRE> + addressbook property add -groups Meeting Date +</PRE><P><H4><A NAME="M21"></A>The [property remove] subcommand</H4> +The third argument of this command can be either a record ID or the +-persons and -groups keywords. If it is the former, the property is removed +from the specified record, otherwise it is removed from all the records of +this type and the return value is now the number of properties successfully +removed. +<PRE> + set theid [addressbook getme -id] + addressbook set $theid MaidenName Violet + addressbook save + addressbook property remove $theid MaidenName +</PRE><P>Remove the properties created above: +<PRE> + addressbook property remove -persons Instrument + addressbook property remove -groups Meeting +</PRE><P><H3><A NAME="M22"></A>The [identifier] subcommand</H3> This command is useful to manage distribution lists, groups used as a mailing list for instance. It has several subcommands (count, -get, primary, set). +get, index, primary, and set).<P><H4><A NAME="M23"></A>The [identifier count] subcommand</H4> <P> Suppose <I>theid</I> is the record ID of a person in the group <I>groupid</I>: <PRE> @@ -326,17 +322,18 @@ <P> Count the identifiers of the Phone property: <PRE> addressbook identifier count $theid Phone -</PRE> -<P> Get some identifiers (suppose here that there are at least two of them): +</PRE><P><H4><A NAME="M24"></A>The [identifier get] subcommand</H4> +<P> Get some identifiers by index (suppose here that there are at least +two of them). Indices start at 0: <PRE> set ident1 [addressbook identifier get $theid Phone 0] set ident2 [addressbook identifier get $theid Phone 1] -</PRE> +</PRE><P><H4><A NAME="M25"></A>The [identifier primary] subcommand</H4> <P> Get the primary identifier (the one which is chosen by default if none has been specified otherwise): <PRE> addressbook identifier primary $theid Phone -</PRE> +</PRE><P><H4><A NAME="M26"></A>The [identifier set] subcommand</H4> <P> Get the current distribution identifier: <PRE> addressbook identifier set $groupid $theid Phone @@ -344,26 +341,37 @@ <P> Set the distribution identifier to <I>ident2</I>: <PRE> addressbook identifier set $groupid $theid Phone $ident2 -</PRE> +</PRE><P><H4><A NAME="M27"></A>The [identifier index] subcommand</H4> <P> The reverse operation of the <B>addressbook identifier get</B> command is the <B>addressbook identifier index</B> command which returns the index corresponding to a given identifier. For instance, the following instruction will return the index 1: <PRE> addressbook identifier index $theid Phone $ident2 -</PRE><P><H3><A NAME="M24"></A>The [label] subcommand</H3> -Let's find the label of the first phone number for a record: +</PRE><P><H3><A NAME="M28"></A>The [export] subcommand</H3> +Create a VCard corresponding to a particular record: <PRE> - set theid [addressbook getme -id] - addressbook label $theid Phone 0 + set theid [lindex [addressbook persons -ids] 0] + set vcardData [addressbook export $theid] </PRE> -The returned string could be Home for instance. Let's change it to -"Personal": +The data returned is binary. You can store it in a file for instance.<P><H3><A NAME="M29"></A>The [import] subcommand</H3> +Import in the database some information stored in a .vcf file. A new +record containing this info, is created in the database: <PRE> - addressbook label $theid Phone 0 Personal - addressbook save -</PRE><P><A NAME="ukl"></A> -<H2><A NAME="M25"></A>Using keyed lists</H2> + 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="M30"></A>The [image] subcommand</H3> +Get the custom image corresponding to a particular record: +<PRE> + set theid [lindex [addressbook persons -ids] 0] + set img [addressbook image $theid] +</PRE> +The data returned is binary. You can store it in a file for instance. +An error is raised if there is no custom image for this record.<P><A NAME="ukl"></A> +<H2><A NAME="M31"></A>Using keyed lists</H2> Keyed lists can be easily manipulated using the <B>keylget</B> and <B>keylset</B> commands defined by the TclX extension. For instance, if a record has been stored in some variable <I>myrecord</I>, one can extract @@ -383,6 +391,6 @@ keylget grp GroupName clock format [keylget grp Modification] </PRE><P><HR> -<P> Last updated 2004-08-01 19:32:54<P> +<P> Last updated 2004-08-02 09:34:50<P> </BODY> </HTML> \ No newline at end of file |