From: John Stone (johns_at_ks.uiuc.edu)
Date: Wed Jan 17 2007 - 12:01:20 CST

Hi,
  the problem with your script when run on windows is likely caused
by spaces in filenames or directories messing up the "split".
If you're put Tcl packages into a directory (e.g. your "e:/vmdextensions/tcl"
example below), you can simply use:
  lappend auto_path e:/vmdextensions/tcl

Then use "package require mypackage" and it will automatically be found if
it is in a subdirectory within your "e:/vmdextensions/tcl".

I'm not sure what went amiss with the script you posted below, as that could
also work, so long as you're careful to avoid spaces in filenames etc.
The script as-written will break if you have any filenames containing spaces.
Here's a fixed version that should also work with spaces:

foreach ext [glob E:/vmdextensions/tcl/*.tcl] {
  puts "sourcing: $ext"
  source $ext
}

If you have any errors within the scripts that you're automatically
sourcing, having that extra "puts" call in there will help you figure
out if the error is in your vmd.rc file, or rather a problem in one
of the scripts that you're sourcing. Once you eliminate the problem(s)
you can simply comment out the puts call.

  John Stone
  vmd_at_ks.uiuc.edu

On Wed, Jan 17, 2007 at 09:31:40AM +0800, wurl wrote:
> hello vmd-l,
>
> //i have added the following scripts in the vmd.rc file to load additional scripts :
>
> #Load Tcl-extensions
> foreach ext [split [glob E:/vmdextensions/tcl/*.tcl]]
> {
> source $ext
> }
> unset ext
>
> //after start VMD, it told me errors like:
>
> wrong # args: should be "foreach varList list ?varList list ...? command"
> invalid command name "
> source $ext
> "
> can't unset "ext": no such variable
>
> //in linux, it does not make errors, are there any difference between the linux and windows tcl scripts?
> //my VMD version is 1.8.5, and are there any other way to load additional tcl scripts? what are the default folder //VMD will search for tcl scripts in windows version 1.8.5 ?
>
>         
> Regards!
>
>         wurl
>         wurl04_at_iccas.ac.cn
>           2007-01-17

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