Jump to content

Open specific folder in explorer


jt6572

Recommended Posts

Hey all,

i have been trying to get this to work for a day or so now, and im at the point where i have no hair left!

 

ive found macro code (okay, "borrowed"...) and opening the current directory is easy.

 

what i would like to do is have buttons for different projects opening its specified project's drawings folder.

 

 

open in current directory:

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

 

open in subfolder "projects" of the R drive:

(startapp "explorer" (strcat "/e, R:\\projects")) 

 

 

using

^C^C_(startapp "explorer" (strcat "/e, F:\Jobs\B16000\B16007\Drawings")

 

this is what i get. (using double backslashes just makes me press enter every time i get to that backslash).

 

Command: _(startapp LISP command is not available.

Command: "explorer" Unknown command ""EXPLORER"". Press F1 for help.

Command: (strcat "/e, F:

("_> Jobs

("_> B16000

("_> B16007

("_> Drawings")

"/e, F:\nJobs\nB16000\nB16007\nDrawings"

 

and nothing happens.

 

i dont know Lisp, so for a start i dont know where to get "startapp.lsp" from. or if it even exists?

 

would really appreciate help with my Noobness....

thank you.

Link to comment
Share on other sites

  • Replies 28
  • Created
  • Last Reply

Top Posters In This Topic

  • jt6572

    15

  • BIGAL

    9

  • ronjonp

    2

  • mostafa badran

    1

Top Posters In This Topic

Posted Images

You can have a directory as an icon on your windows taskbar, just google for info. Then just double click the drawing you want.

 

http://www.digitalcitizen.life/how-pin-any-folder-windows-7-taskbar

 

Mine are set up as project drive, lisps so I can drag and drop lisps outside of normal library, project time logging and last is what you want 1 project directory.

Screen Shot 12-08-16 at 12.16 PM.jpg

Link to comment
Share on other sites

thanks BigAl,

i will keep playing with it, but replicating your code to my filepath isnt working.

i am getting

" _(startapp LISP command is not available.

Command: "explorer" Unknown command ""EXPLORER"". Press F1 for help.

 

do you know how i can make startapp lisp available?! is this a .lsp i just dont have?

 

thanks again.

Edited by jt6572
Link to comment
Share on other sites

got it!

 

http://forums.augi.com/archive/index.php/t-162038.html

 

not sure about forum ethics or whatever, but basically, what i had to do was create a simple lisp and then have the macro call that lisp.

 

my example is:

 

Lisp:

 

(defun B16007 ()
(STARTAPP (strcat "EXPLORER /e," "F:\\Jobs\\B16000\\B16007\\Drawings"))
)

 

macro assigned to button:

 

^C^C(B16007)

 

I looked for this a lot, so hopefully this will help anyone else with the same issue.

 

thanks for all your help again BigAl - i know youve helped me a lot on here in the past as well. :)

Link to comment
Share on other sites

got it!

 

http://forums.augi.com/archive/index.php/t-162038.html

 

not sure about forum ethics or whatever, but basically, what i had to do was create a simple lisp and then have the macro call that lisp.

 

my example is:

 

Lisp:

 

(defun B16007 ()
(STARTAPP (strcat "EXPLORER /e," "F:\\Jobs\\B16000\\B16007\\Drawings"))
)

macro assigned to button:

 

^C^C(B16007)

I looked for this a lot, so hopefully this will help anyone else with the same issue.

 

thanks for all your help again BigAl - i know youve helped me a lot on here in the past as well. :)

 

You can modify your code as below.

 

(defun c:B16007 ()
(STARTAPP (strcat "EXPLORER /e," "D:\\Jobs\\B16000\\B16007\\Drawings"))
 (princ)
)

and your macro to:

^C^C B16007;

Link to comment
Share on other sites

jt6572 there is a way to type any combo of B1234 B456 b789123 etc this causes an error as "command is unknown" but if you always have a consistent "B" as 1st character and the directory structure is always the same you can make it work with 1 Library function rather than multiple defuns for each project.

 

Here is the code for Fillet Offset & Circle typed directly basicly cutting out one or two steps F123 means a fillet with radius 123. It uses a command has errored but looks at what was typed and pulls it apart then executes the correct command.

 

Code revised see post further down that meets the request.

Edited by BIGAL
Link to comment
Share on other sites

wow, this is getting good! :D

if i am able to get this cracking it would be awesome, as B is simply the prefix for all our Brisbane projects. Cryptic.

 

im not a lisp expert by any stretch, so if i step through, could you please help me? could take a bit of patience...and i am happy with my progress already. :)

 

from the code, it looks like i might be able to use just one of the wcmatch...paragraphs (told you im no coder!!) and replace the C with a B?

i dont know how to mix this with what i have already though. but i have a little time to work on this at the moment, so will wreak some lisp havoc!

Link to comment
Share on other sites

Your correct add the "B" and make a new defun name say "openex" and use what you have for the startapp.

 

If you look at the variable com this will return project number, its an interesting idea may have a go myself as our projects are based on the year+project number 2016123

 

This code is autoloaded from our company lisp library, try the fillet circle etc remember a decimal is a "-" f12-5

Link to comment
Share on other sites

Nope. no idea what i am doing. btw, for some reason, the first time i click on a button for a directory it repeats the last command.

is there a space or "" or \ somewhere it shouldnt be in my existing lisp?

 

(defun jobs ()
(STARTAPP (strcat "EXPLORER /e," "F:\\Jobs"))
)

 

 

  ; Enter the filet radius as part of a command line entry f100 offset O234 circle c123-45 
; note - is used for decimal point
; original code and methology by Alan H
; assistance and code that worked by Lee-Mac
; OCT 2015

(   (lambda nil
       (vl-load-com)
       (foreach obj (cdar (vlr-reactors :vlr-command-reactor))
           (if (= "openx" (vlr-data obj))
               (vlr-remove obj)
           )
       )
       (vlr-command-reactor "openx" '((:vlr-unknowncommand . openx-callback)))
   )
)

(defun openx ( obj com )
(setq com (vl-string-translate "-" "." (strcase (car com))))


   (cond   
       (   (and
           (wcmatch com "~*[~B.0-9]*")
           (wcmatch com "B*")
           (wcmatch com "~B*B*")
           (wcmatch com "~*.*.*")
           ) ; and
           (openx) 
        )

   ) ; master cond
) ; defun

(STARTAPP (strcat "EXPLORER /e," "F:\\Jobs\\B16000\\B16007\\Drawings"))
)

(princ)

Link to comment
Share on other sites

You need to go back a bit your mixing up the defuns and have put openx into like a repeating defun.

 

I am using defun openx and "D" the code will auto reuse the Dproject number "123345" etc so no individual hard coded filename is required. You must have a rigid directory structure for it to work.

 

(   (lambda nil
       (vl-load-com)
       (foreach obj (cdar (vlr-reactors :vlr-command-reactor))
           (if (= "fillet-reactor" (vlr-data obj))
               (vlr-remove obj)
           )
       )
       (vlr-command-reactor "fillet-reactor" '((:vlr-unknowncommand . fillet-reactor-callback)))
   )
)

; open a project that is 3 directory deep just by project number 
; my example c:\2016 projects\2016123\design

(defun openx ( / Proj)
           (setq projno (strcat "EXPLORER C:\\" (substr com 2 4) " Projects\\" (substr com 2) "\\Design\\")) 
           (vla-sendcommand fillet-reactor-acdoc (STARTAPP projno))                   
)

; calls the fillet command with the radius f123
(defun filletrad ( / rad)
(setq rad (distof (substr com 2) 2))
           (if (<= 0.0 rad)
             (progn        
             (setvar 'filletrad rad)
             (vla-sendcommand fillet-reactor-acdoc "_.fillet ")
             )
             ) 
)

;calls the circle command with radius c123
(defun makecirc ( / rad radd)
(setq rad (distof (substr com 2) 2))
           (if (<= 0.0 rad)
           (progn 
           (setvar 'circlerad rad)
           (setq pt (getpoint "Pick centre pt"))       
           (vla-sendcommand fillet-reactor-acdoc "_.Circle !pt  ")       
           )
           )
)

;calls offset with a distance + or - for left and right O123
(defun offdist ( / dist)
(setq dist (distof (substr com 2) 2))
           (if (<= 0.0 dist)
           (progn        
           (setvar 'offsetdist dist)
           (vla-sendcommand fillet-reactor-acdoc "_.Offset  ")
           )
           )
)

; calls a lisp program
(defun pipeoff ( / dist)
(setq dist (distof (substr com 2) 2))
           (if (<= 0.0 dist)
           (progn
           (setq poff (strcat "P" (rtos dist 2 0)))
           (if (not poff)(load "Pipe offsets"))
           (vla-sendcommand fillet-reactor-acdoc poff)
           )
           )
)



; start of call back F O P D as 1st character
(defun fillet-reactor-callback ( obj com )
(setq com (vl-string-translate "-" "." (strcase (car com))))
   (cond   
; open explorer
        (  (and
           (wcmatch com "~*[~D.0-9]*")
           (wcmatch com "D*")
           (wcmatch com "~D*D*")
           (wcmatch com "~*.*.*")
           ) ; and
           (openx) 
        )
; fillet
       (   (and
           (wcmatch com "~*[~F.0-9]*")
           (wcmatch com "F*")
           (wcmatch com "~F*F*")
           (wcmatch com "~*.*.*")
           ) ; and
           (filletrad) 
        ) 
; circle
        (  (and
           (wcmatch com "~*[~C.0-9]*")
           (wcmatch com "C*")
           (wcmatch com "~C*C*")
           (wcmatch com "~*.*.*")
           ) ;and
           (makecirc) 
        )
; offset
        (  (and
           (wcmatch com "~*[~O.0-9]*")
           (wcmatch com "O*")
           (wcmatch com "~O*O*")
           (wcmatch com "~*.*.*")
           ) ; and
           (offdist) 
        )

; pipe
        (  (and
           (wcmatch com "~*[~P.0-9]*")
           (wcmatch com "P*")
           (wcmatch com "~P*P*")
           (wcmatch com "~*.*.*")
           ) ; and
           (pipeoff) 
        )

   ) ; master cond
) ; defun

Edited by BIGAL
Link to comment
Share on other sites

  • 2 weeks later...

wow, im a bit too lost trying to work with this.

i have just been trying to open a folder that is within the current drawing's folder with very poor results!

within the same folder as all the drawings is a folder for all the pdfs, as well as the xrefs, etc. is there a way to do a sort of "relative" open to open folder "pdf"?

i actually tried to modify this!

^C^C(startapp "explorer" (findfile "Drawing Register.xlsm"))

 

to

 

^C^C(startapp "explorer" (findfolder "PDF"))

 

in an amazing show of ignorance...

 

oh well... had a go!! at least i am not a man who never made anything hey?! :lol:

Link to comment
Share on other sites

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...