the script that wouldn't quit - - until it has to

Discussion in 'AutoCAD' started by Guest, Feb 16, 2005.

  1. Guest

    Guest Guest

    ADT 3.0 and XP

    Let's say that I have open 4 drawings: A, B, C and D. And let's say that I
    am currently looking at B. From within B, I run a program [currently LISP]
    and determine that I really want to be on D to execute this. I have a
    programatic [VBA] way to CTRL+TAB and cycle through A, B, C and D. I am in
    need of a script to cycle until I get where I want to be and then stop and
    execute. I don't mind writing this script on the fly just prior ro calling
    it, if that will make it work.

    Am I missing something obvious like a (setvar "DWGNAME" "----------"). Too
    bad that one is read-only. I have also tried RSCRIPT without luck.

    What I've got below is two rather incomplete ideas. Here is what I am
    trying so far:


    Thanks for any ideas. If you don't hear back from me after Thursday night -
    I am on vacation. WooHoo . . . I'll check in upon return [26 Feb]



    ctrltab.scr
    =======
    this does toggle to the next drawing [from B to C] and (load "JBAdtl"). I
    figure out that I am not at D yet and was hoping the script would call
    itself and toggle from C to D, figure out that I am where I want to be and
    stop. Maybe the script calling itself is the problem and using two
    identical scripts that called each other on every other drawing would work
    better?

    -vbarun
    "Q:\JBA\CAD Tools\acad.dvb!ThisDrawing.CtrlTab"
    (load "JBAdtl")
    script
    Q:\ChrisG\lsp\ctrltab




    ctrltab.lsp
    =======

    ;;; VBA that performs a CTRL+TAB to toggle to the next drawing
    (defun CTRLTAB () (command "-vbarun" "Q:\\JBA\\CAD
    Tools\\acad.dvb!ThisDrawing.CtrlTab"))


    ;;; This is a snip of code to make sure that if I determine that I am
    looking for E
    ;;; and don't have it open, I don't just CTRL+TAB forever through A, B, C
    and D.
    ;;; I think I will end up hard coding the (getvar "DWGNAME") into the script
    file
    ;;; and using it with an (if ... to determine that I have cycled through all
    open drawings.

    (defun DCHK ()
    (setq dwgnam (getvar "DWGNAME"))
    (while (/= tmpnam dwgnam)
    (if (/= (substr (getvar "DWGNAME") 7 3) dtlsca)
    (progn
    (CTRLTAB)
    (setq tmpnam (getvar "DWGNAME"))
    )
    )
    )
    )
     
    Guest, Feb 16, 2005
    #1
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.