macro: can I escape backslash to automate a text string with fields?

macro: can I escape backslash to automate a text string with fields?

andrea_ricciNMVSG
Contributor Contributor
448 Views
1 Reply
Message 1 of 2

macro: can I escape backslash to automate a text string with fields?

andrea_ricciNMVSG
Contributor
Contributor

Hello all,

I wish to make a menu macro that outputs a text string containing some fields relevant to the plot. I already use it inside a block, trough attributes, but I want it also as a single string of text. The ouput will be

file: myfile.dwg | currentlayoutl | currentplotstyle.ctb | unit | papersize

the relative text with the fields is

 

 

file: %<\AcVar Filename \f "%fn6">% | %<\AcVar ctab>% | %<\AcVar PlotStyleTable>% | %<\AcDiesel $(index,$(getvar,insunits),"-,in,ft,mi,mm,cm,m,km,µin,mil,yd,Å,nm,μm,dm,dam,hm,Gm,au,ly,pc")>% | %<\AcVar PaperSize>%

 

 

and Ìm trying to write the macro like this:

 

 

^C^C_TEXT;\;;'example string above';

 

 

The problem is that the text string is full of backslashes, required by the fields, so the macro pauses for input even if inside a string delimited by  quotes. 

The output is only "file: %< stopping for user input at the first backslash.

Is there any way to escape the backslash?

I prefer not to use autolisp to give it to my collegues that use Acad lite.

Thank you very much

0 Likes
Accepted solutions (1)
449 Views
1 Reply
Reply (1)
Message 2 of 2

Paul_Gander
Advocate
Advocate
Accepted solution

You could put the following in a script file:

text
@
0
file: %<\AcVar Filename \f "%fn6">% | %<\AcVar ctab>% | %<\AcVar PlotStyleTable>% | %<\AcDiesel $(index,$(getvar,insunits),"-,in,ft,mi,mm,cm,m,km,µin,mil,yd,Å,nm,μm,dm,dam,hm,Gm,au,ly,pc")>% | %<\AcVar PaperSize>%

And create a macro to run the script:

^c^c_id;\_script;"scriptfilename"
0 Likes