LISP running in menu macro stops when argument contains servername with slashes

LISP running in menu macro stops when argument contains servername with slashes

dmfrazier
Advisor Advisor
646 Views
2 Replies
Message 1 of 3

LISP running in menu macro stops when argument contains servername with slashes

dmfrazier
Advisor
Advisor

I have written an AutoLISP function for plotting model space that takes two arguments: the first is the name of a Windows System Printer, the second is the name of a Page Setup.  Normally this function is placed in a menu macro with the following syntax:

 

(MyPlotLISP "<System Printer Name>" "<Page Setup Name>")

 

This function has been working well for years in many different menu macros, but today, when I attempt to use it with a system printer whose name contains backslashes (and foreslashes), it stops.

 

The name of the system printer on this particular machine (which I cannot change without causing others a major inconvenience) is "\\COPYCENTER\4820/9148/8148".

 

So, I have written the macro this way: ^C^C^P(load "MyPlotLISP") (MyPlotLISP "\\\\MyPrinterServer\\1234/2345/3456" "MyPageSetupName") .

 

If I execute this code from the command line, it runs right through.

When I click the toolbar button to run the macro, it stops somewhere after the function loads.  The odd thing is that nothing appears on the commandline.  If I hit Enter, this appears: ("_> , which tells me that it's waiting for something (a parenthesis?, a quote mark?, user input?, not sure).

 

Is there a trick to getting this to work with such an argument? Or am I out of luck?

 

Thanks.  

0 Likes
Accepted solutions (1)
647 Views
2 Replies
Replies (2)
Message 2 of 3

rkmcswain
Mentor
Mentor
Accepted solution

I didn't test your code, but I've run into what you're seeing in the past.
Menu macros (toolbars or any other element) introduce problems with slashes.

What I've done in the past in these cases is to create a lisp function and store it in the <menuname>.MNL file, then call this function in the CUIX element macro.

 

;;; Example MNL file contents
(defun macro1 ()
   (MyPlotLISP "\\\\MyPrinterServer\\1234/2345/3456" "MyPageSetupName")
)

;;; then your menu macro will look something like this
^c^c(macro1);

 

A desirable side effect is that changes can be easily made and tested in the VLIDE, instead of having to open and close the CUI editor.

 

R.K. McSwain     | CADpanacea | on twitter
0 Likes
Message 3 of 3

dmfrazier
Advisor
Advisor

Great idea.  I have never used MNL files in my customizing, but I'll do that for this special case and see how it works out.

 

This is one of those cases where so many different things (dependencies) have to be lined up just right (printer names, drivers, PC3 files, page setups in DWGs, LSP files, icons...) that it can be difficult to keep track of all the pieces. It's annoying that the solution to this particular issue introduces another "layer" (LSP to run LSP), but if it works...

 

Thanks very much.

0 Likes