LosGirk Posted May 31, 2017 Posted May 31, 2017 Is there a way around having spaces in a network path location and/or spaces in a filename? For example: (defun c:test (/ ) (command "start" "c:\\Data\\Current Excel Programs\\2017 file gen.xls") (princ )) hangs up on me. I have to put it like this (with underscores) to work: (defun c:test (/ ) (command "start" "c:\\Data\\Current_Excel_Programs\\2017_file_gen.xls") (princ )) This is not necessarily a problem, I'm just wondering if there's a way around it. Thank you. Quote
LosGirk Posted May 31, 2017 Author Posted May 31, 2017 Thank you tombu for the lead. And as always Thank you Lee Mac! You guys are SuperBomb! Quote
Lee Mac Posted May 31, 2017 Posted May 31, 2017 Thanks for the recommendation tombu Another alternative could be: (startapp "explorer" "\"c:\\Data\\Current Excel Programs\\2017 file gen.xls\"") Quote
BIGAL Posted May 31, 2017 Posted May 31, 2017 Had the same problem with block names, opening the external block dwg. ; (openblk "P:/ACADSTDS/CIVIL STANDARDS/AD00702") (defun openblk (blkname / adocs) (setq acDocs (vla-get-documents (vlax-get-acad-object))) (vla-open acDocs blkname) (vla-activate (vla-item acdocs 1)) ) Quote
tombu Posted June 1, 2017 Posted June 1, 2017 In code I generally use (chr 92) for "\\" and (chr 47) for "/" so it works the same in macros as it does on the command line. One more with a few examples for opening various file types: (defun MyOpen (FileName ReadOnly / ) ; (while (vl-string-search "\\" FileName) (setq FileName (vl-string-subst "/" "\\" FileName))) ; (while (vl-string-search "/" FileName) (setq FileName (vl-string-subst "\\" "/" FileName))) (vla-activate (vla-Open (vla-get-Documents (vlax-get-Acad-Object)) FileName (if ReadOnly :vlax-true :vlax-false) ) ) ) ;|(MyOpen (strcat (getvar "roamablerootprefix")"Support" (chr 92) "acaddoc.lsp") nil)(princ)) (MyOpen "C:\\Documents and Settings\\User\\Application Data\\Autodesk\\AutoCAD Map 3D 2008\\R17.1\\enu\\support\\acaddoc.lsp" nil) ^C^C^P(or openfile(load "MyOpen.lsp"));(openfile "Description Key Code.doc") ^C^C^P(or C:MyOpen(load "MyOpen.lsp"));(openfile "G:/DavidK/Feature Code Listing.mht") ^C^C^P(or C:MyOpen(load "MyOpen.lsp"));(MyOpen "G:/TOMBU/Blocks/Leon_County_Plans_Binder.dwg" nil)(princ) ^C^C^P(or C:MyOpen(load "MyOpen.lsp"));(MyOpen "MapAnnotation.txt" nil)(princ) ^C^C^P(or C:MyOpen(load "MyOpen.lsp"));(MyOpen (getenv "QnewTemplate") nil)(princ) ^C^C^P(or C:MyOpen(load "MyOpen.lsp"));(MyOpen (strcat (getvar "localrootprefix") "template" (chr 92) "map2d_Leon.dwt") nil)(princ) ^C^C^P(or C:MyOpen(load "MyOpen.lsp"));(MyOpen (strcat (getvar "localrootprefix") "template" (chr 92) "FLHP-NF.dwt") nil)(princ) ^C^C^P(or C:MyOpen(load "MyOpen.lsp"));(MyOpen "FLHP-NF.dwt" nil)(princ) ^C^C^P(or C:MyOpen(load "MyOpen.lsp"));(MyOpen "" nil)(princ) ^C^C^P(or C:MyOpen(load "MyOpen.lsp"));(MyOpen "" nil)(princ) ^C^C^P(or C:MyOpen(load "MyOpen.lsp"));(MyOpen "acaddoc.lsp" nil)(princ) ^C^C^P(or C:MyOpen(load "MyOpen.lsp"));(MyOpen (strcat (getvar "localrootprefix") "template" (chr 92) "FLHP-NF.dwt") nil)(princ) ^C^C^P(or C:MyOpen(load "MyOpen.lsp"));(MyOpen (strcat (getvar "localrootprefix") "template" (chr 92) "map2d_Leon.dwt") nil)(princ) ^C^C^P(or C:MyOpen(load "MyOpen.lsp"));(MyOpen (getenv "QnewTemplate") nil)(princ) ^C^C^P(or C:MyOpen(load "MyOpen.lsp"));(MyOpen "//Pubworks/Sys2/USERS/ENGDESGN/BeaufordT/Blocks/Leon_County_Plans_Binder.dwg" nil)(princ) ^C^C^P(progn(startapp "explorer" (strcat "/n,/e," (getvar "roamablerootprefix")"Support" )(chr 92) "Express")(princ)) |; This handy macro prompts to open a drawing in the current folder: ^C^C^P(vla-activate(vla-open (vla-get-documents (vlax-get-acad-object))(findfile(getfiled "Select File" (getvar 'dwgprefix) "dwg" ) :vlax-false)) Lee's code does a lot of cool stuff I've never completely figured out: (LM:Open (strcat (chr 47) "n," (chr 47) "e, " (chr 47) "root, " (chr 92) (chr 92) "Pubworks" (chr 92) "Sys2" (chr 92) "USERS" (chr 92) "ENGDESGN" (chr 92) (getenv "USERNAME"))) (LM:Open (strcat (chr 92) (chr 92) "Pubworks" (chr 92) "Sys2" (chr 92) "USERS" (chr 92) "ENGDESGN" (chr 92) (getenv "USERNAME"))) File Selected by the User: (LM:Open (getfiled "Select File to Open" "" "" 16)) Drawing File at a Specified Location: (LM:Open "C:\\My Folder\\File.dwg") Directory: (^C^C^P(or C:MyOpen(load "MyOpen.lsp"));LM:Open "C:/My Folder/My SubFolder") Directory: ^C^C^P(or C:MyOpen(load "MyOpen.lsp"));(LM:Open "C:/Program Files/Autodesk/AutoCAD Civil 3D 2012/Help/Civil Tutorials") Internet Explorer: (LM:Open 1) User Start Menu Programs: (LM:Open 2) All Control Panel Items: (LM:Open 3) the Printers Folder: (LM:Open 4) My Documents Folder: (LM:Open 5) My Favorites Folder: (LM:Open 6) or (LM:Open 31) the Startup Folder: (LM:Open 7) the Recent Items Folder: (LM:Open the SendTo Folder: (LM:Open 9) the Recycle Bin: (LM:Open 10) User Start Menu: (LM:Open 11) My Music: (LM:Open 13) My Videos: (LM:Open 14) User Desktop: (LM:Open 16) My Computer: (LM:Open 17) the Network Folder: (LM:Open 18) the Network Shortcuts Folder: (LM:Open 19) the Fonts Special Folder: (LM:Open 20) Windows Templates: (LM:Open 21) or (LM:Open 45) Windows Start Menu: (LM:Open 22) Windows Start Menu Programs: (LM:Open 23) Windows Startup Folder: (LM:Open 24) or (LM:Open 30) Public Desktop: (LM:Open 25) User Roaming Folder: (LM:Open 26) Printer Shortcuts Folder: (LM:Open 27) User AppData Local Folder: (LM:Open 28) User Startup Folder: (LM:Open 29) Temporary Internet Files Folder: (LM:Open 32) Cookies Folder: (LM:Open 33) |; Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.