From: John Stone (johns_at_ks.uiuc.edu)
Date: Sat Mar 31 2007 - 00:19:20 CDT

Hi,
  In order to make VMD find your new plugin, you need to put it in
a directory somewhere, and then add that directory to the Tcl auto_path.
VMD does this automatically for its own plugin directories, but for
extensions you write yourself, you'll want to add them by adding commands
to your .vmdrc, e.g.:
  lappend auto_path [file join $env(HOME) myplugins]

In order to add things to the VMD extensions menu, you can do
stuff like this in your .vmdrc:
  # test to see if we're running with a GUI or not
  global tk_version
  if { [info exists tk_version] } {
    vmd_install_extension exmp exmp_tk "Example"
  }

Cheers,
  John Stone
  vmd_at_ks.uiuc.edu

On Fri, Mar 30, 2007 at 09:58:17AM -0400, James Keener wrote:
> Thank you. I didn't run pkg_mkIndex. Once I did that, I types "package
> require exmp" and got the old package not found error. I was reading the
> comments in the pkIndex.tcl file (something that continently mentions
> pkg_mkIndex....) and saw that $dir needs to be set and the the file
> needs sourced, so I did that, and it worked. My question now is, how do
> I get vmd to automatically load my extension on start up.
>
> Thanks for your time,
> Jim
>
> John Stone wrote:
> >Hi,
> > Did you remember to run "pkg_mkIndex ." in the directory containing
> >exmp.tcl to create the necessary pkgIndex.tcl file? Before you try
> >adding it to the VMD menu with vmd_install_extension you'll want to
> >make sure that it correctly autoloads when you run the command:
> > package require exmp
> >
> >Once that works, I would expect your script to work from the GUI as well
> >assuming there are no other problems. (The code below looked fine in
> >my very quick examination..)
> >
> > John Stone
> > vmd_at_ks.uiuc.edu
> >
> >On Wed, Mar 28, 2007 at 10:45:18AM -0400, James Keener wrote:
> >
> >>I'm trying to create a plugin (with tcl/tk) for vmd, and after a google
> >>search, found
> >>http://www.ks.uiuc.edu/Research/vmd/plugins/doxygen/tcltkplugins.html
> >>
> >>I used that and another pre-existing extension to create this file
> >>(exmp.tcl):
> >>
> >>package provide exmp 0.1
> >>
> >>namespace eval ::Exmp:: {
> >>namespace export exmp
> >>variable w
> >>}
> >>
> >>proc ::Exmp::exmp {} {
> >>variable w
> >>
> >># create main window frame
> >>set w .exmp
> >>catch {destroy $w}
> >>toplevel $w
> >>wm title $w "Example"
> >>wm resizable $w 0 0
> >>}
> >>
> >>proc exmp_tk {} {
> >>::Exmp::exmp
> >>return $::Exmp::w
> >>}
> >>
> >>in ~/lib/vmd/plugins/noarch/tcl/exmp0.1/. When I open vmd and type
> >>"vmd_install_extension exmp exmp_tk "Example", it adds the "Example"
> >>menu item but also says "The exmp package could not be loaded:" and no
> >>more but a new line. Would anyone be willing to give some advice or
> >>know of a tutorial that doesn't assume prior knowledge of how to get
> >>this all to work? Any help is appreciated.
> >>
> >>Thanks,
> >>Jim
> >>
> >
> >

-- 
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