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 (705 Views)
Accepted Solution

[problem] SPACE in folder or path name

705 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,

 

*Expert Elite*
pbejse
Posts: 2,440
Registered: ‎11-24-2009
Message 2 of 5 (695 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: 1,890
Registered: ‎12-15-2006
Message 3 of 5 (688 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

*Expert Elite*
braudpat
Posts: 1,890
Registered: ‎12-15-2006
Message 4 of 5 (687 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

Mentor
aqdam1978
Posts: 265
Registered: ‎11-05-2008
Message 5 of 5 (664 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.

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community