Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

[problem] SPACE in folder or path name

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
aqdam1978
3486 Views, 4 Replies

[problem] SPACE in folder or path name

Hi,

 

I'm try to write a list to produce a script file!

I just want to insert a dwg file in current drawing.

 

back to MS Windows, in case of having [space] in a folder's name, we should use "" marks:

CD "Program Files"; DEL "file 10.txt"; ....

 

I tried both with and without "" marks but I failed!

I pasted part of my code below with result of each case:

 

---------------- FIRST TRY: without "" marks-----------------------------------
(setq TBFile "H:\z.autocad\A1 A2 A3.dwg")
(write-line "-INSERT" des)
(write-line (strcat "*" TBFile) des); ; *H:\z.autocad\A1 A2 A3.dwg  <<=should be this
(write-line "0,0" des);;insert point
(write-line "1" des);;xyz scale
(write-line "0" des);;rotation

;;after script running:
Command: -INSERT
Enter block name or [?]: *H:\z.autocad\A1    <<<=== truncate filename!
"A1.dwg": Can't find file in search path
---------------- SECOND TRY: with "" marks ------------------------------------
(setq TBFile "H:\z.autocad\A1 A2 A3.dwg")
(write-line "-INSERT" des)
(write-line (strcat "*" (strcat "\"" TBFile "\"")) des); *"H:\z.autocad\A1 A2 A3.dwg" <<=should be this
(write-line "0,0" des);;insert point
(write-line "1" des);;xyz scale
(write-line "0" des);;rotation

;;after script running:
Command: -INSERT
Enter block name or [?]: *"H:\z.autocad\A1  <<<=== truncate filename also!
""H:\z.autocad\A1.dwg": Invalid file name.
*Invalid*
-----------------------------------------------------------------------------

 

Please help me!

 

Thanks,

 

4 REPLIES 4
Message 2 of 5
pbejse
in reply to: aqdam1978

Not sure, but did you try wraqpping the filepath with a double quote ""

 

(setq TBFile "H:\\z.autocad\\A1 A2 A3.dwg")

 

(write-line (strcat "\"*" TBFile "\"") des)

 

I'm not really a big fan os script 🙂

 

Message 3 of 5
braudpat
in reply to: pbejse

 

Hello

 

If possible when I run Scripts on many DWGs, I try to have my DWGs files

inside Pathes without any special chars (please no space/blank) !

 

With this constraint, Script Files are easier to write and test ...

 

Bye, Patrice

 

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Message 4 of 5
braudpat
in reply to: braudpat

 

ReHello

 

And of course no special chars (no space/blank) inside filenames !

 

And the life (with ACAD, Scripts, Lisp, etc) is better and easier ... 

 

Bye, Patrice

 

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Message 5 of 5
aqdam1978
in reply to: pbejse

Hi,

this scrip is ok:

---------------------

-INSERT
"*C:\Users\aaqdam\Desktop\A1 A2 A3.dwg"
0,0
1
0

-------------------

 

Thanks for your help.

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost