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

code break down newbie help: escape characters

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
omartin
571 Views, 5 Replies

code break down newbie help: escape characters

I was trying to write a prog. to open the directory of what ever file was opened. After some time i came across this:

 

(startapp "explorer" (strcat "/n,/e," (getvar "dwgprefix")))

 

What I am trying to figure out is the /n,/e, part. I know they are escape characters, but cant find any info on how this is working.

I found the meaning of them:

 

  • \e Escape character
  • \n Newline character

but what is the difference between the \ and /, if i change the code to use \ instead, it will only open my c drive:

 also I dont know what the \e means, I can understand sending the newline character but what is the purpose of sending the escape" character? if I take out the /e it still works, but I still have to leave the "," after the /n.

 

Thanks for any help!

5 REPLIES 5
Message 2 of 6
Kent1Cooper
in reply to: omartin


@omartin wrote:

I was trying to write a prog. to open the directory of what ever file was opened. After some time i came across this:

 

(startapp "explorer" (strcat "/n,/e," (getvar "dwgprefix")))

 

What I am trying to figure out is the /n,/e, part. ....


It doesn't really answer your question, but I find that to do what you are trying to do, those escape characters do not seem to be necessary at all.  This, without them or the (strcat) that joins them to the directory location, opens Windows Explorer in the current drawing's directory:

 

(startapp "explorer" (getvar "dwgprefix"))

 

Perhaps the reason you want to open that directory is to open another drawing in it, in order to avoid having to navigate around to it if a different folder is current in the Open dialog box.  For that, I use this little routine to open a Drawing in the Current Folder:
 

;;;  DCF.lsp
;;;  to open a Drawing in the Current drawing's Folder
(defun C:DCF ()
  (vla-activate
    (vla-open
      (vla-get-documents
        (vlax-get-acad-object)
      )
      (getfiled "Select drawing:" (getvar 'dwgprefix) "dwg" 0)
    )
  )
)
(prompt "\nType DCF to open a Drawing in the Current Folder.")

 

Kent Cooper, AIA
Message 3 of 6
omartin
in reply to: Kent1Cooper

Thanks Kent; I was trying different things, from shell to startapp, all the code examples I came across had those escape characters, so I was just trying to figure how this code was waorking, they didnt seem that nessessary to me either.

 

But yeah I Just wanted to open another drawing, or non cad file from the same dir.

Message 4 of 6
sdoman
in reply to: omartin

 

The "/n,/e," look like escape charachters.  But in this case, they are command line options for running Explorer. 

 

Here's a link that explains what those options do:

http://support.microsoft.com/kb/152457

Message 5 of 6
phanaem
in reply to: omartin

Use

(startapp "EXPLORER.exe" (strcat "\/n,\/e,"(getvar "DWGPREFIX")))

or

(startapp "EXPLORER.exe" (getvar "DWGPREFIX"))

 

If Explorer is already opened and it show Dwgprefix location, the last one will simply pop up Explorer window. The first one will create a new window, even if there is another one created.

Message 6 of 6
omartin
in reply to: phanaem

Sdoman, Phanaem; Thanks again for the info! it all makes sense now.

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

Post to forums  

Autodesk Design & Make Report

”Boost