Path to the current lisp file, and a return value from shell

Path to the current lisp file, and a return value from shell

Anonymous
Not applicable
1,954 Views
3 Replies
Message 1 of 4

Path to the current lisp file, and a return value from shell

Anonymous
Not applicable

While lisp file is executing, is it possible to get a full path to it with a script command?

 

Is it possible to get a return value from shell into lisp file? eg would like to execute something like "shell chdir" and get a current directory back into a variable in a lisp file.

 

Thank You.

0 Likes
Accepted solutions (1)
1,955 Views
3 Replies
Replies (3)
Message 2 of 4

scot-65
Advisor
Advisor
Perhaps look into FINDFILE and/or VL-FILENAME-DIRECTORY?

Is the LISP loaded via CUI or APPLOAD?
If so, you may be out of luck?

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 3 of 4

Anonymous
Not applicable

Thanks for the reply. It is acad.lsp file, but it could be on different folders as users could have it on different folders. I guess findfile probably works the same way as the code which is used by autocad to locate acad.lsp, so in theory it should find itself first?

0 Likes
Message 4 of 4

dgorsman
Consultant
Consultant
Accepted solution

That entirely depends if (load ...) was called without a path, or if (findfile ...) or a functionally similar process was used to provide a full path.  Otherwise there is no "generic" means of telling where a LISP was loaded from e.g. a different file search function was used, or a user drag-dropped the LISP file into the active drawing.

 

If its crucial for you to know where LISP files have been loaded from create your own wrapper function which calls (load ...).  You can then keep track of where individual files are loaded from.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.