Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Mentor
265 Posts
9 Kudos
Registered: ‎11-05-2008
Post 1 of 5
Accepted Solution

[problem] SPACE in folder or path name

810 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*
2,535 Posts
306 Kudos
Registered: ‎11-24-2009
Post 2 of 5

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*
2,463 Posts
263 Kudos
Registered: ‎12-15-2006
Post 3 of 5

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*
2,463 Posts
263 Kudos
Registered: ‎12-15-2006
Post 4 of 5

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
265 Posts
9 Kudos
Registered: ‎11-05-2008
Post 5 of 5

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
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!