[Tcladdressbook-commits] Help TclAB_QuickStart.html,1.6,1.7
Status: Alpha
Brought to you by:
bdesgraupes
|
From: Bernard D. <bde...@us...> - 2004-07-29 13:31:54
|
Update of /cvsroot/tcladdressbook/Help In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5549/Help Modified Files: TclAB_QuickStart.html Log Message: New 1.1b1 commands Index: TclAB_QuickStart.html =================================================================== RCS file: /cvsroot/tcladdressbook/Help/TclAB_QuickStart.html,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- TclAB_QuickStart.html 26 Jan 2004 23:07:23 -0000 1.6 +++ TclAB_QuickStart.html 29 Jul 2004 13:31:45 -0000 1.7 @@ -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.0b1. All the Tcl instructions in the sections +version 1.1b1. 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, @@ -25,19 +25,21 @@ <UL><LI><A HREF="#M5">The [getme] subcommand</A></UL> <UL><LI><A HREF="#M6">The [record] subcommand</A></UL> <UL><LI><A HREF="#M7">The [type] subcommand</A></UL> -<UL><LI><A HREF="#M8">The [remove] subcommand</A></UL> -<UL><LI><A HREF="#M9">The [parents] subcommand</A></UL> -<UL><LI><A HREF="#M10">The [create] subcommand</A></UL> -<UL><LI><A HREF="#M11">The [property names] subcommand</A></UL> -<UL><LI><A HREF="#M12">The [property type] subcommand</A></UL> -<UL><LI><A HREF="#M13">The [property add] subcommand</A></UL> -<UL><LI><A HREF="#M14">The [property remove] subcommand</A></UL> -<UL><LI><A HREF="#M15">The [export] subcommand</A></UL> -<UL><LI><A HREF="#M16">The [import] subcommand</A></UL> -<UL><LI><A HREF="#M17">The [image] subcommand</A></UL> -<UL><LI><A HREF="#M18">The [set] subcommand</A></UL> -<UL><LI><A HREF="#M19">The [search] subcommand</A></UL> -<LI><A HREF="#M20">Using keyed lists</A> +<UL><LI><A HREF="#M8">The [delete] subcommand</A></UL> +<UL><LI><A HREF="#M9">The [add] subcommand</A></UL> +<UL><LI><A HREF="#M10">The [remove] subcommand</A></UL> +<UL><LI><A HREF="#M11">The [parents] subcommand</A></UL> +<UL><LI><A HREF="#M12">The [create] subcommand</A></UL> +<UL><LI><A HREF="#M13">The [property names] subcommand</A></UL> +<UL><LI><A HREF="#M14">The [property type] subcommand</A></UL> +<UL><LI><A HREF="#M15">The [property add] subcommand</A></UL> +<UL><LI><A HREF="#M16">The [property remove] subcommand</A></UL> +<UL><LI><A HREF="#M17">The [export] subcommand</A></UL> +<UL><LI><A HREF="#M18">The [import] subcommand</A></UL> +<UL><LI><A HREF="#M19">The [image] subcommand</A></UL> +<UL><LI><A HREF="#M20">The [set] subcommand</A></UL> +<UL><LI><A HREF="#M21">The [search] subcommand</A></UL> +<LI><A HREF="#M22">Using keyed lists</A> </UL> First load the extension like this <PRE> @@ -81,7 +83,12 @@ </PRE> The value of <I>myrecord</I> is a keyed list. One can use the usual Tcl list commands to parse this value or special commands defined in the TclX -extension (see section <A HREF="#ukl">Using keyed lists</A> below).<P><H3><A NAME="M6"></A>The [record] subcommand</H3> +extension (see section <A HREF="#ukl">Using keyed lists</A> below). +<P> The <I>getme</I> command can also be used with an <I>-id</I> option. +In that case the unique ID of the "Me" record is returned: +<PRE> + set myID [addressbook getme -id] +</PRE><P><H3><A NAME="M6"></A>The [record] subcommand</H3> Store the ID of the first record in the variable <I>theid</I> <PRE> set theid [lindex [addressbook persons -ids] 0] @@ -102,7 +109,7 @@ to the ID <I>$theid</I> <PRE> addressbook type $theid -</PRE><P><H3><A NAME="M8"></A>The [remove] subcommand</H3> +</PRE><P><H3><A NAME="M8"></A>The [delete] subcommand</H3> Remove from the database the record corresponding to the ID <I>$theid</I> <PRE> addressbook delete $theid @@ -114,14 +121,22 @@ Save the changes to make them permanent <PRE> addressbook save -</PRE><P>Remove from a specific group the record corresponding to the ID <I>$theid</I>: -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><P><H3><A NAME="M9"></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). <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="M9"></A>The [parents] subcommand</H3> + addressbook add $theid $groupid +</PRE><P><H3><A NAME="M10"></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> + set groupid [lindex [addressbook groups -ids] 0] + set theid [lindex [addressbook persons -ids] 0] + addressbook remove $theid $groupid +</PRE><P><H3><A NAME="M11"></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] @@ -130,7 +145,7 @@ 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="M10"></A>The [create] subcommand</H3> +</PRE><P>One can also find the parents of a group using this command.<P><H3><A NAME="M12"></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 @@ -145,37 +160,47 @@ 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="M11"></A>The [property names] subcommand</H3> +</PRE><P><H3><A NAME="M13"></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="M12"></A>The [property type] subcommand</H3> +</PRE><P><H3><A NAME="M14"></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="M13"></A>The [property add] subcommand</H3> +<I>String</I> and <I>MultiDictionary</I>.<P><H3><A NAME="M15"></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="M14"></A>The [property remove] subcommand</H3> -Remove the properties created above: +</PRE><P><H3><A NAME="M16"></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> + 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="M15"></A>The [export] subcommand</H3> +</PRE><P><H3><A NAME="M17"></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] </PRE> -The data returned is binary. You can store it in a file for instance.<P><H3><A NAME="M16"></A>The [import] subcommand</H3> +The data returned is binary. You can store it in a file for instance.<P><H3><A NAME="M18"></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> @@ -184,14 +209,14 @@ set vcard [read $fid] close $fid addressbook import $vcard -</PRE><P><H3><A NAME="M17"></A>The [image] subcommand</H3> +</PRE><P><H3><A NAME="M19"></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><H3><A NAME="M18"></A>The [set] subcommand</H3> +An error is raised if there is no custom image for this record.<P><H3><A NAME="M20"></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> @@ -228,7 +253,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="M19"></A>The [search] subcommand</H3> +</UL><P><H3><A NAME="M21"></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 @@ -272,8 +297,8 @@ addressbook search -persons -nocase Address >= {"" {"" abc}} </PRE> </UL><P><A NAME="ukl"></A> -<H2><A NAME="M20"></A>Using keyed lists</H2> -Keyed lists can be easily manipulated using the <B> keylget </B> and +<H2><A NAME="M22"></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 various fields like this: @@ -292,6 +317,6 @@ keylget grp GroupName clock format [keylget grp Modification] </PRE><P><HR> -<P> Last updated 2004-01-24 08:09:04<P> +<P> Last updated 2004-07-29 15:11:20<P> </BODY> </HTML> \ No newline at end of file |