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:
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!
Solved! Go to Solution.
Solved by phanaem. Go to Solution.
Solved by sdoman. Go to Solution.
@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.")
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.
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:
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.