How to add space or double quotes?

How to add space or double quotes?

Anonymous
Not applicable
1,523 Views
11 Replies
Message 1 of 12

How to add space or double quotes?

Anonymous
Not applicable

Hello,

 

how to add space or double quotes in command?

 

OK

^C^C_setenv RDCambiaStato $M=$(eval,"RDCambiaStato.cmd_")$(getvar,dwgname);

I get RDCambiaStato_DWGNAME

 

KO

^C^C_setenv RDCambiaStato $M=$(eval,"RDCambiaStato.cmd ")$(getvar,dwgname);

I get RDCambiaStato ONLY and than dwgname,

cause space is like ENTER

 

How to fix it?

Thanks, regards Massimo

0 Likes
1,524 Views
11 Replies
Replies (11)
Message 2 of 12

Moshe-A
Mentor
Mentor

diesel does not have a function setenv (only getenv same as it does not have setvar only getvar)

are you using AutoCAD LT?

 

 

0 Likes
Message 3 of 12

Anonymous
Not applicable

HEllo,

 

yes I'm using autocad LT.

 

^C^C_setenv RDCambiaStato $M=$(eval,"RDCambiaStato.cmd "$(getvar,dwgname)")

 

If I open test.dwg in Autocad LT, then I run 

MODEMACRO

$(eval,"RDCambiaStato.cmd $(getvar,dwgname)")

 

I get :

 

RDCambiaStato.cmd TEST.DWG

 

But I need it WITH double quote

"RDCambiaStato.cmd TEST.DWG"

 

Is it possible some how?

Thanks, regards

Massimo

 

 

0 Likes
Message 4 of 12

Moshe-A
Mentor
Mentor

if environment variable RDCambiaStato is fixed why don't you set it in the macro?

0 Likes
Message 5 of 12

Anonymous
Not applicable

Hello,

 

thanks for helping, try to better explain.

 

it's a general request.

 

My need is to add at the beginning and the end of a string double quotes.

Because _startapp with path containg spaces, will not work

if not "enclosed" by quotes.

 

I'm new to diesel and acad lt macro.

What I'm not able to do is something like (VBA just as an example)

Dim command as string

command = chr(34) & "RDCambiaStato.cmd " & DWGNAME & chr(34)  

debug.print command

 

I will get

"RDCambiaStato.cmd  TEST.DWG"

 

I'm not able to "build" a string, that contain double quotes

in DIESEL or COMMAND macro "syntax".

 

Thanks

regards

Massimo

0 Likes
Message 6 of 12

ВeekeeCZ
Consultant
Consultant
I guess you've already tried the usual: Prefix " or \.
""TEST""
or
\"TEST\"
0 Likes
Message 7 of 12

Moshe-A
Mentor
Mentor

as far as i know startapp is an autolisp function

but in your acadlt.pgp there should be start command.

 

so did that and it works perfect

^C^Cstart $m=$(eval, notepad.exe);

 

i think no quotes is needed, the diesel (eval) function just takes your entry and makes it a string

 

0 Likes
Message 8 of 12

cadffm
Consultant
Consultant
No shell functions available from pgp in LT.

You can store your information without "" in one enviroment variable, "NextFile" for example, and start your program with mtexted trick or by AI_STARTAPP.
The external program have to do all other things (read the value of NextFile and do whateveryouwant with that information).


Sebastian

0 Likes
Message 9 of 12

Anonymous
Not applicable

Hello,

 

thanks for info.

 

BUT If I need to pass the DWGname as parameter to AI_STARTAPP

as an example. AI_STARTAPP dosomething.cmd DWGNAME, where DWGNAME contain spaces?

 

Cause AI_STATAPP DOSOMETHING.cmd is working fine.
WHEN I need to pass DWGNAME as argument, I'm not able to do it.


Thanks, regards Massimo

0 Likes
Message 10 of 12

cadffm
Consultant
Consultant
Hi Massimo,
I know that and i described the workaround, so why do you repead the words about this (not working) direct way?

Sebastian

0 Likes
Message 11 of 12

Anonymous
Not applicable

Hello Sebastian,

thanks

pls can you write a "working" example on how to do it?

I can't figure out, that's why keep asking.

 

"Following" your instruction, I tried to create two enviroment variables:

1. NextFile (OK) : _setenv NextFile $M=$(getvar,dwgname) 

2. MYCMD (OK) :  _setenv MYCMD "RDCambiaStato.cmd" 

3. Start App with combination of MYCMD and Nextfile, inside quote (KO)

 _startapp "$(getvar,MYCMD) $(getvar,NextFile)"

 

But is not working for me.

 

Here the "full" command:

 

^C^C_setenv NextFile $M=$(getvar,dwgname) _setenv MYCMD "RDCambiaStato.cmd" GETENV NextFile;GETENV MYCMD;AI_STARTAPP "$(getvar,MYCMD) $(getvar,NextFile)"

 

Command Line Output:

Comando: _setenv Immettere il nome della variabile: NextFile Valore <$M=$(getvar,dwgname)>: $M=$(getvar,dwgname)
Comando: _setenv Immettere il nome della variabile: MYCMD Valore <RDCambiaStato.cmd>: "RDCambiaStato.cmd"
Comando: _startapp AI_STARTAPP "$(getvar,MYCMD) $(getvar,NextFile)"
Impossibile trovare l'applicazione $(getvar,MYCMD) $(getvar,NextFile).

>>Cannot find application $(getvar,MYCMD) $(getvar,NextFile).

 

Thanks, regards

Massimo

0 Likes
Message 12 of 12

Anonymous
Not applicable

**** UPDATE ****

 

Sorry, the full command is:

 

^C^C_setenv NextFile $M=$(getvar,dwgname) _setenv MYCMD "RDCambiaStato.cmd" GETENV NextFile;GETENV MYCMD;AI_STARTAPP $M=$(getenv,MYCMD) $M=$(getenv,NextFile)

 

Command Output:

 

_setenv Immettere il nome della variabile: NextFile Valore <Disegno2.dwg>: Disegno2.dwg
Comando: _setenv Immettere il nome della variabile: MYCMD Valore <RDCambiaStato.cmd>: RDCambiaStato.cmd
Comando: GETENV Immettere il nome della variabile: NextFile
Disegno2.dwg
Comando: GETENV Immettere il nome della variabile: MYCMD
RDCambiaStato.cmd
Comando: AI_STARTAPP RDCambiaStato.cmd
Comando: Disegno2.dwg Comando sconosciuto "DWG". Premere F1 per la Guida.

As you see, the space make the argument to be interpreted as a separate command. 

AI_STARTAPP $M=$(getenv,MYCMD) $M=$(getenv,NextFile)

Like if I run

AI_STARTAPP  RDCambiaStato.cmd (Enter)

Disegno2.dwg (Enter)

Thanks, regards

 

0 Likes