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

Find current lisp file path

8 REPLIES 8
Reply
Message 1 of 9
ditran
4154 Views, 8 Replies

Find current lisp file path

Hi All,

 

Is there any way to find the path of current lisp file. For example,If we located test.lsp file on C driver, the function will return "C:\test.lsp".etc...

 

Thanks for any help.

8 REPLIES 8
Message 2 of 9
Lee_Mac
in reply to: ditran

What do you mean by 'current lisp file'?

Message 3 of 9
bhull1985
in reply to: ditran

(findfile "yourfile.lsp") in autocad will return the location of "yourfile" within the autocad search paths, if it exists...

hopefully that helps

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please use code tags and credit where credit is due. Accept as solution, if solved. Let's keep it trim people!
Message 4 of 9
ditran
in reply to: bhull1985

Thanks for reply. But I want to find the saved path of lisp file being edited. I want to load other file in same folder which located anywhere.Maybe it's not loacted in Autocad search path.

 

 

Message 5 of 9
bgingerich
in reply to: ditran

There may be a way to retrieve the "last opened file" location from a registery entry somewhere?  I only have LT at the moment, so I can't help you with the actual entry.  

 

This is the folder for recent files in 2010 LT.  May or may not help you...

HKEY_CURRENT_USER\Software\Autodesk\AutoCAD LT\R15\ACADLT-8001:409\Recent File List

 

HTH

─────────────────────────────────────────────────────────────────────────────────────────────
Brandon Gingerich
Message 6 of 9
Lee_Mac
in reply to: ditran


@ditran wrote:

I want to find the saved path of lisp file being edited.


 

If you are referring to a LISP file that is being edited within the Visual LISP IDE, you could read the *edit-file-history* section of the VLIDE.DSK file.

Message 7 of 9
wdwolff1
in reply to: ditran

Hello, have you find athe solution.

i am also looking for it.

if you found a solution can you mail me?

email: wdwolff@planet.nl

Message 8 of 9
Moshe-A
in reply to: wdwolff1

@wdwolff1 hi,

 

i googled and the only solution i found for knowing the full path of lisp file comes from dos_lib.

 

1. install >> mcneel doslib << on your autocad

2. on each source lisp file set an id something like (setq MY_LISP_ID "MyLispID.lsp")

3 . call the following nice function.

 

be aware for the file type. if you are compiling the lsp to fas or vlx.

also note there could be 2 lsp files with the same name coming from different folders.

 

enjoy

Moshe

 

 

 

 

(defun get_fullpath_lispname (fname / modula)
 (cond
  ; make sure doslib is loaded 
  ((null (member (setq modula (strcat "doslib" (substr (getvar "acadver") 1 2) "x64.arx")) (arx))
   (prompt (strcat "\n" modula " is not loaded."))
  ); case
  ((vl-some
     (function
       (lambda (fpath)
         (if (eq (strcase (strcat (vl-filename-base fpath) (vl-filename-extension fpath))) (strcase fname)) fpath)
       )
     )
    (dos_lisplist t) 
   )
  ); case
 ); cond
); get_fullpath_lispname

 

 

 

Message 9 of 9
john.uhden
in reply to: ditran

@ditran 

I'm sorry, but as I recall there is no way using AutoLisp to find the path of a loaded lisp file.

Owen Wengerd (Manusoft) used to provide us a VLXLOAD.arx to snag the name/path of a VLX file when it's loaded but I don't know if he has provided same for newer releases (since about 2006).

John F. Uhden

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

Post to forums  

”Boost