From: John Stone (johns_at_ks.uiuc.edu)
Date: Wed May 03 2006 - 10:12:03 CDT

Enzo,
  You can put your Tcl routines anywhere you like, and then either
source them with a fully qualified path name, or you can make them into
Tcl packages (add 'package provide mystuff 1.0' to the top of the file,
then in VMD or tclsh, do 'pkg_mkIndex . ' in that directory) and use
the 'lappend auto_path' Tcl variable to tell VMD where to find these
packages. This is how I test new VMD plugins that aren't part of
VMD yet, for example:
  lappend auto_path [file join $env(HOME) myplugins]

I've written a little bit about writing VMD Tcl/Tk plugins/extension menu
items in the plugin developer's documentation:
  http://www.ks.uiuc.edu/Research/vmd/plugins/doxygen/tcltkplugins.html

There's MUCH more information on these topics in the Tcl documentation:
  http://wiki.tcl.tk/1628
  http://www.tcl.tk/man/tcl8.4/TclCmd/library.htm
  http://www.tcl.tk/man/tcl8.4/TclCmd/pkgMkIndex.htm

  John Stone
  vmd_at_ks.uiuc.edu

On Wed, May 03, 2006 at 04:13:42PM +0200, Enzo Vitale wrote:
> Dear VMD people,
>
> I wrote some scripts (thanks for your previous very quick replies!)
> and now I would like to be able to call them from my local .vmdrc
> command files, without replicating them in each of these files.
>
> The question is: where should I put the source of my subroutines in
> order for the TCL interpreter to find them automatically? Do I need to
> put each subroutine in a different source file (maybe with the same
> name as the subroutine)? And in which directory should these files be
> placed?
>
> I was not able to find an answer to this question in the (in any case
> excellent!) User's Guide.
>
> Thank you in advance,
> Enzo

-- 
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
Email: johns_at_ks.uiuc.edu                 Phone: 217-244-3349
  WWW: http://www.ks.uiuc.edu/~johns/      Fax: 217-244-6078