Search code examples
tclpspiceorcad

Run sequentially cir and net files with tcl/tk


I would like to give me your advice about using cadence orcad so I can run sequentially cir or net(netlist) files with pspice.exe in cmd of my pc.

I use tcl/tk language.I have tried a few things without any results.

I want to make something similar to this one:

set top  {C:\Users\file1.net C:\Users\file2.net}; 
foreach a $top 
{exec D:\\tools\\bin\\pspice.exe -r $a}

Solution

  • There are two problems in your code. The first problem is that \f is an escape character sequence in lists (for “go down one line”, IIRC; point is you don't want that interpretation). The second problem is that you've got your brace placement wrong in your foreach.

    The first problem is best addressed by using / instead of \, and then using file nativename on the value fed to the OS. (You have to do that manually for argument to executables in expr; Tcl can't fix that for you entirely automatically.) The second problem is just a syntax error.

    Try this:

    set top {C:/Users/file1.net C:/Users/file2.net}
    set pspice D:/tools/bin/pspice.exe
    foreach a $top {
        # Tcl knows how to convert executable names for you; not the other args though
        exec $pspice -r [file nativename $a]
    }