Author Topic: startapp opening folders getfiled? I dunno... help  (Read 2757 times)

0 Members and 1 Guest are viewing this topic.

Russ

  • Guest
startapp opening folders getfiled? I dunno... help
« on: April 28, 2005, 12:07:32 PM »
I'm trying to create a routine that will allow me to open up our drawing directory and allow me to select which folder I want and I'm not sure how
to make the routine prompt me to enter the folder name. Our folders are named as such: 2003, 2004, 2005 etc... and Where I'm having trouble is getting the routine to ask for a folder name. I'm no way a Lisper, but was giving it a whirl. I want to be able to do this without selecting with the mouse. Heres what I have so far:
 
(DEFUN C:OPN ()
(COMMAND "START" "X:\Drawings\\Commercial\\2004" "")
)
 
Where I have 2004 is where I want to be promt for the folder name. Thanks for all input.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
startapp opening folders getfiled? I dunno... help
« Reply #1 on: April 28, 2005, 12:31:11 PM »
Open the folder up with Windows Explorer?
TheSwamp.org  (serving the CAD community since 2003)

nivuahc

  • Guest
startapp opening folders getfiled? I dunno... help
« Reply #2 on: April 28, 2005, 12:41:28 PM »
This will open Windows Explorer in the current (working) folder:

Code: [Select]
(startapp "C:/windows/explorer.exe" (getvar "DWGPREFIX"))

Replace the
Code: [Select]
(getvar "DWGPREFIX")

portion with the absolute path that you want to use. Like this:

Code: [Select]
(startapp "C:/windows/explorer.exe" "X:\\Drawings\\Commercial\\2004")

And, remember, if you are going to use a backslash (\) then you need to double them up (\\). You can use a forward slash (/) all by itself.

nivuahc

  • Guest
startapp opening folders getfiled? I dunno... help
« Reply #3 on: April 28, 2005, 12:45:01 PM »
You know, I just re-read all of this and I'm betting that the answer I gave is in no way what you were looking for. :)

What you are trying to do (a guess here) is, for instance, create a toolbar button that works just like the "Open" button. Only, instead of opening to the last directory you worked on, you want it to open to a specified folder to save the drafters a few clicks.

Am I right?

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
startapp opening folders getfiled? I dunno... help
« Reply #4 on: April 28, 2005, 12:49:31 PM »
I'm guessing something like this.

Code: [Select]

(defun c:opn (/ path dir)
   (setq path "C:\\Temp\\Dwgs\\"); <-- change to suit your needs

   (if
(not (= (setq dir (getstring "\nEnter Folder Name: ")) ""))
 (if (findfile (strcat path dir))
(startapp (strcat "explorer.exe /n,/root," path dir))
         ; else
(alert "Folder not found")
)
 )
   (princ)
   )


*edited*
missed placed ")"
TheSwamp.org  (serving the CAD community since 2003)

ELOQUINTET

  • Guest
startapp opening folders getfiled? I dunno... help
« Reply #5 on: April 28, 2005, 12:53:31 PM »
not sure i follow either but if you're trying to open any of these directories from within autocad why not just browse to each then right click in the left bar and add current folder. then you'll have shortcuts to all of those directories (if that's what you meant???).

daron

  • Guest
startapp opening folders getfiled? I dunno... help
« Reply #6 on: April 28, 2005, 01:17:56 PM »
Russ, I changed your title. If you don't like it, feel free to change it. Just make it more descriptive than Lisp Help. Thank you.

Hint: click edit on your original post.

Russ

  • Guest
startapp opening folders getfiled? I dunno... help
« Reply #7 on: April 28, 2005, 01:24:10 PM »
No problem Daron.... Thanks, Nivuahc & Mark, for the input. You both gave me the info I needed. Again, Thanks.

nivuahc

  • Guest
startapp opening folders getfiled? I dunno... help
« Reply #8 on: April 28, 2005, 06:27:54 PM »
my (our, I'm sure) pleasure! :)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
startapp opening folders getfiled? I dunno... help
« Reply #9 on: April 28, 2005, 07:15:37 PM »
Code: [Select]
; Example: (ALE_BrowseForFolder "Select drawings folder")
;
; Original BrowseForFolder by Tony Tanzillo
;
(defun ALE_BrowseForFolder (PrmStr / ShlObj Folder FldObj OutVal)
   (vl-load-com)
   (setq
     ShlObj (vla-getInterfaceObject
              (vlax-get-acad-object)
                "Shell.Application")
     Folder (vlax-invoke-method ShlObj 'BrowseForFolder 0 PrmStr 0)
   )
   (vlax-release-object ShlObj)
   (if Folder
      (progn
         (setq FldObj (vlax-get-property Folder 'Self)
               OutVal (vlax-get-property FldObj 'Path)
         )
         (vlax-release-object Folder)
         (vlax-release-object FldObj)
         OutVal
      )
   )
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
startapp opening folders getfiled? I dunno... help
« Reply #10 on: April 28, 2005, 07:21:14 PM »
Here is another, kinda clunky.
Code: [Select]
(setq path (substr
             (setq fakefile
                (getfiled "Select a Folder: "
                          "Pick Save When Done"
                          "*"
                          7)) 1 (- (strlen fakefile) 19)))

                         
And another
Code: [Select]
(setq myfile (getfiled "Choose A Directory" "z. " " " 1))
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
startapp opening folders getfiled? I dunno... help
« Reply #11 on: April 28, 2005, 08:15:46 PM »
CAB --

Cool idea but ...
Quote from: Russ
I want to be able to do this without selecting with the mouse


:)
TheSwamp.org  (serving the CAD community since 2003)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
startapp opening folders getfiled? I dunno... help
« Reply #12 on: April 28, 2005, 10:26:18 PM »
Ooops, :oops:
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.