IT renamed network printers - Help please

Discussion in 'AutoCAD' started by bsteele, Sep 24, 2004.

  1. bsteele

    bsteele Guest

    Due to a corporate policy change, all network printers names had to be changed. You all know what that can to do plotting, page setups and whatnot. What I'd like to do is to run a little lisp at startup to ease the pain. Below is code I've been working on all day and I can't seem to feed the new name back into AutoCAD. I'm stuck.

    ;CODE
    (vl-load-com)
    (defun changeprintername (/ old new)
    (setq new "PR44454-PCL")
    (setq old (vla-get-configname (vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object)))))
    (if(= old "\\\\PC47302S\\HP8100NPCL")
    (progn
    (setq old new)))
    (vla-put-configname old new)
    )
    (changeprintername)

    This is the error I get at the command line:
    Command: (LOAD "S:/CADD/ACAD2K/Lisp/changeprinternames1.lsp") ; error: bad
    argument type: VLA-OBJECT "PR44454-PCL"

    I know it's the Vla-put stuff and I just can't seem to get the right syntax. I could really use some help. TIA
     
    bsteele, Sep 24, 2004
    #1
  2. bsteele

    Dan Allen Guest

    I get a PC3 file when I use:

    Command: (vla-get-configname (vla-get-activelayout (vla-get-activedocument
    (vlax-get-acad-object))))
    "C:\\Program Files\\AutoCAD 2000i\\plotters\\Olive.pc3"

    Not a driver name (unless your dropping the extension?).
    I think you'll have to recreate all your PC3 files for the new network name.
    Of course if AutoDesk didn't encode the PC3 (& CTB/STB) files with zlib,
    then you could just do a search & replace with an ascii file like we did
    with old R14 acad.cfg files...

    Dan


    changed. You all know what that can to do plotting, page setups and whatnot.
    What I'd like to do is to run a little lisp at startup to ease the pain.
    Below is code I've been working on all day and I can't seem to feed the new
    name back into AutoCAD. I'm stuck.
    (vla-get-activedocument (vlax-get-acad-object)))))
    syntax. I could really use some help. TIA
     
    Dan Allen, Sep 25, 2004
    #2
  3. bsteele

    bsteele Guest

    Thanks for your response. The code written above is merely a "test". I plan on doing this for all system printers as well as any *.pc3 files. I figured if I could get AutoCAD to recognize the "new" printer name as the "old" printer, then I could use that "formula" to do the same for all of the printers. Basically, what I want is for AutoCAD to see the old names and "think" it's using the new ones. I hope this makes sense. Any and all help is appreciated.
    TIA,
    Brad
     
    bsteele, Sep 25, 2004
    #3
  4. bsteele

    Dan Allen Guest

    I use this to read/set plotters, probably taken from acadx/codemine:

    ;;;=============================================
    ;;; Gets current plotter
    ;;; returns "yourprinter.pc3"
    ;;;=============================================
    (defun XYZ_GetActiveLayoutConfigname ( / adoc actlay)
    (setq adoc (vla-get-activedocument (vlax-get-acad-object))
    actlay (vla-get-activelayout adoc)
    )
    (vla-get-Configname actlay)
    )

    ;;;=============================================
    ;;; Sets current plotter
    ;;;=============================================
    (defun XYZ_PutActiveLayoutConfigname (device / adoc actlay)
    (setq adoc (vla-get-activedocument (vlax-get-acad-object))
    actlay (vla-get-activelayout adoc)
    )
    (vla-put-Configname actlay device)
    )


    plan on doing this for all system printers as well as any *.pc3 files. I
    figured if I could get AutoCAD to recognize the "new" printer name as the
    "old" printer, then I could use that "formula" to do the same for all of the
    printers. Basically, what I want is for AutoCAD to see the old names and
    "think" it's using the new ones. I hope this makes sense. Any and all help
    is appreciated.
     
    Dan Allen, Sep 27, 2004
    #4
  5. bsteele

    bsteele Guest

    Hi Dan,

    Thanks for the reply. I'm not really sure how to combine what you've provided into what I'm doing. So I tried this:

    (vl-load-com)
    (defun changeprintername (/ old new adoc actlay)
    (setq new "PR44454-PCL")
    (setq old (vla-get-configname (vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object)))))
    (if(= old "\\\\PC47302S\\HP8100NPCL")
    (progn
    (setq adoc (vla-get-activedocument (vlax-get-acad-object))
    actlay (vla-get-activelayout adoc)
    )
    (vla-put-configname actlay new)))
    (if(= old "\\\\PC47302S\\HP8100n")
    (progn
    (setq adoc (vla-get-activedocument (vlax-get-acad-object))
    actlay (vla-get-activelayout adoc)
    )
    (vla-put-configname actlay new)))
    )

    (changeprintername)

    and guess what? It works, a least so far with the minimal testing i've done.

    Thanks Dan, you got me over the hump!
     
    bsteele, Sep 27, 2004
    #5
  6. bsteele

    bsteele Guest

    Update:

    It works with system printers as well as *pc3 files. Enjoy!

    ;;changeprinternames.lsp by Brad Steele
    ;;replace existing printer names with the new ones
    ;;Self running. To use: Place this file on support path
    ;;At command prompt: (load "changeprintername")
    ;;Update as necessary for your own printers


    (vl-load-com)
    (defun changeprintername (/ old old1 old2 new new1 new2 adoc adoc1 adoc2 actlay)
    (setq new "PR44454-PCL");<-update as necessary
    (setq new1 "PL42936-PCL");<-update as necessary
    (setq new2 "PR44405-PCL");<-update as necessary
    (setq old (vla-get-configname (vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object)))))
    (if(= old "\\\\PC47302S\\HP8100NPCL");<-update as necessary
    (progn
    (setq adoc (vla-get-activedocument (vlax-get-acad-object))
    actlay (vla-get-activelayout adoc)
    )
    (vla-put-configname actlay new)))
    (if(= old "\\\\PC47302S\\HP8100n");<-update as necessary
    (progn
    (setq adoc (vla-get-activedocument (vlax-get-acad-object))
    actlay (vla-get-activelayout adoc)
    )
    (vla-put-configname actlay new)))
    (if(= old "HP8100n.pc3");<-update as necessary
    (progn
    (setq adoc (vla-get-activedocument (vlax-get-acad-object))
    actlay (vla-get-activelayout adoc)
    )
    (vla-put-configname actlay new)))

    (if(= old "HP8100N.pc3");<-update as necessary
    (progn
    (setq adoc (vla-get-activedocument (vlax-get-acad-object))
    actlay (vla-get-activelayout adoc)
    )
    (vla-put-configname actlay new)))

    (setq old1 (vla-get-configname (vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object)))))
    (if(= old1 "HP1055CM.pc3");<-update as necessary
    (progn
    (setq adoc1 (vla-get-activedocument (vlax-get-acad-object))
    actlay (vla-get-activelayout adoc1)
    )
    (vla-put-configname actlay new1)))
    (if(= old1 "\\\\PC47302S\\HP1055CM");<-update as necessary
    (progn
    (setq adoc1 (vla-get-activedocument (vlax-get-acad-object))
    actlay (vla-get-activelayout adoc1)
    )
    (vla-put-configname actlay new1)))

    (setq old2 (vla-get-configname (vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object)))))
    (if(= old2 "\\\\PC47302S\\HP2600PCL");<-update as necessary
    (progn
    (setq adoc2 (vla-get-activedocument (vlax-get-acad-object))
    actlay (vla-get-activelayout adoc2)
    )
    (vla-put-configname actlay new2)))
    (if(= old2 "HP2600PCL.pc3");<-update as necessary
    (progn
    (setq adoc2 (vla-get-activedocument (vlax-get-acad-object))
    actlay (vla-get-activelayout adoc2)
    )
    (vla-put-configname actlay new2)))
    )

    (changeprintername)
    (princ)
     
    bsteele, Sep 27, 2004
    #6
  7. bsteele

    Rick Keller Guest

    Just a question, I read some of the earlier posts but skipped a few.

    Why cant you fix the pagesetups in your templates then create a routine that
    will import
    the new setups into your old drawings so they too will have the new setups?

    Rick
     
    Rick Keller, Sep 28, 2004
    #7
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.