Jump to content

open current file containing folder


leonucadomi

Recommended Posts

 

please help with lsp routine that opens current drawing folder....

 

I tried this and it didn't work

 

(defun c: fl ()
(startapp "explorer" (getvar "dwgprefix"))
(princ)
)

 

Link to comment
Share on other sites

Also not s LISP, but if you right click drawings tab under the menu bar there is an option "open file location"

Link to comment
Share on other sites

Macro I've used for years:

^C^C^P(vla-activate(vla-open (vla-get-documents (vlax-get-acad-object))(findfile(getfiled "Select File" (getvar 'dwgprefix) "dwg" 8)) :vlax-false))

My acaddoc.lsp starts with (vl-load-com) which could be added to the start of the macro if you don't already have it loaded as most visual lisp requires it.

  • Like 1
Link to comment
Share on other sites

 

the macro is great however I need it to open the windows explorer where the other files of the folder where the file comes from are shown

Link to comment
Share on other sites

22 minutes ago, leonucadomi said:

 

the macro is great however I need it to open the windows explorer where the other files of the folder where the file comes from are shown

Just replace dwg in the macro with "" to show all files in the folder.

Help for getfiled: https://help.autodesk.com/view/ACD/2022/ENU/?guid=GUID-AD65DF88-5218-4655-B877-B4D33B9FB6D1

 

To open Windows Explorer in the current directory I use the macro:

^C^C^P(progn(startapp "explorer" (strcat "/n,/e," (getvar "dwgprefix")))(princ)) 

Command Name:  Explore Here...

Description:            Open Windows Explorer in Drawing Directory

Link to comment
Share on other sites

20 minutes ago, leonucadomi said:

 

the macro is great however I need it to open the windows explorer where the other files of the folder where the file comes from are shown

 

This will allow you to change the folder location that opens starts in current drawing folder. Need write permission but nothing is saved.

 

;;----------------------------------------------------------------------------;;
;; OPEN WINDOWS EXPLORER TO FOLDER OF CURRENT DRAWING.
(defun C:DIR ()
  (setq path (strcat (getvar 'DWGPREFIX) "\\Enter or Save to Open Folder"))
  (if (setq fp (getfiled "Folder to Open:" path "" 33))
    (startapp "explorer" (strcat "/n,/e," fp))
  )
)

 

/n Open a new single-pane window for the default selection

/e Open Windows Explorer in its default view

also suggest to get power toys for fancy zone.

  • Agree 1
Link to comment
Share on other sites

Try this,

 

(defun c:GetFolder() ;;opens the drawings folder
;;  (command "shell" (strcat "explorer \"" (getvar 'dwgprefix) "\""))
  (startapp "explorer" (strcat "/e,\"" (vl-string-right-trim "\\" (getvar 'dwgprefix)) "\""))
  (princ)
)

 

It's been a while since I made this up but from what I remember it will work either way with the 'shell' line or with the 'startapp' line. Might even work with both and open explorer twice if you leave both lines in. 'Startapp' might be a bit quicker.

  • Like 1
Link to comment
Share on other sites

  • 1 year later...

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...