Author Topic: printerconfigpath automation error  (Read 2219 times)

0 Members and 1 Guest are viewing this topic.

dubb

  • Swamp Rat
  • Posts: 1105
printerconfigpath automation error
« on: August 26, 2015, 05:29:14 PM »
Code: [Select]
(vl-load-com)
(setq PreferenceFiles (vla-get-files (vla-get-preferences (vlax-get-acad-object))))
;print/plotter settings
(setq AddPrintPath (strcat "n:\\cad_support\\plotter"))
(setq CurrentPrintPath (strcat (vla-get-PrinterConfigPath PreferenceFiles)))
(setq NewPrintPath (strcat AddPrintPath";"CurrentPrintPath))
(vla-put-printerconfigpath PreferenceFiles NewPrintPath)

I get an error
Quote
Automation Error. Invalid Argument

What am I doing wrong? :nerdyembarassed:

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: printerconfigpath automation error
« Reply #1 on: August 26, 2015, 05:47:01 PM »
I don't see anything wrong with your code - perhaps there is a bug with the ActiveX printerconfigpath property.

Try the following alternative method, changing the registry value directly:
Code - Auto/Visual Lisp: [Select]
  1. (setq new "n:\\cad_support\\plotter"
  2.       cur (getenv "PrinterConfigDir")
  3. )
  4.     (setenv "PrinterConfigDir" (strcat new ";" cur))
  5. )

dubb

  • Swamp Rat
  • Posts: 1105
Re: printerconfigpath automation error
« Reply #2 on: August 26, 2015, 05:56:58 PM »
This works Thanks Lee.

I don't see anything wrong with your code - perhaps there is a bug with the ActiveX printerconfigpath property.

Try the following alternative method, changing the registry value directly:
Code - Auto/Visual Lisp: [Select]
  1. (setq new "n:\\cad_support\\plotter"
  2.       cur (getenv "PrinterConfigDir")
  3. )
  4.     (setenv "PrinterConfigDir" (strcat new ";" cur))
  5. )

ChrisCarlson

  • Guest
Re: printerconfigpath automation error
« Reply #3 on: August 27, 2015, 08:26:47 AM »
I'm not sure what you are even trying to do ? All you really need to do is

Code - Auto/Visual Lisp: [Select]


Not sure why you are pulling the old config path?

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: printerconfigpath automation error
« Reply #4 on: August 27, 2015, 08:44:28 AM »
Not sure why you are pulling the old config path?

The OP is adding a new path to the existing set of paths.

ChrisCarlson

  • Guest
Re: printerconfigpath automation error
« Reply #5 on: August 27, 2015, 10:27:59 AM »
His snippet seems to works on Vanilla 2016. He just needs to add a check to prevent duplicate line items.

Is there an advantage to writing to the registry directly vs ActiveX?