Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Mentor
aqdam1978
Posts: 265
Registered: ‎11-05-2008
Message 1 of 5 (784 Views)
Accepted Solution

[problem] SPACE in folder or path name

784 Views, 4 Replies
02-12-2013 07:26 PM

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,

 

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 :smileyhappy:

 

Hi,

this scrip is ok:

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

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

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

 

Thanks for your help.

 

*Expert Elite*
pbejse
Posts: 2,529
Registered: ‎11-24-2009
Message 2 of 5 (774 Views)

Re: [problem] SPACE in folder or path name

02-12-2013 09:09 PM 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 :smileyhappy:

 

*Expert Elite*
braudpat
Posts: 2,407
Registered: ‎12-15-2006
Message 3 of 5 (767 Views)

Re: [problem] SPACE in folder or path name

02-12-2013 11:11 PM 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

 

Bye, Pat ( Supporting Troops )
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Compliment) - Thanks
*Expert Elite*
braudpat
Posts: 2,407
Registered: ‎12-15-2006
Message 4 of 5 (766 Views)

Re: [problem] SPACE in folder or path name

02-12-2013 11:13 PM 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

 

Bye, Pat ( Supporting Troops )
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Compliment) - Thanks
Mentor
aqdam1978
Posts: 265
Registered: ‎11-05-2008
Message 5 of 5 (743 Views)

Re: [problem] SPACE in folder or path name

02-13-2013 07:34 AM 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.

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.