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

Browse for directory again

18 REPLIES 18
Reply
Message 1 of 19
Anonymous
597 Views, 18 Replies

Browse for directory again

I have spent the past hour searching the help files and the news groups but still don't have a clean answer (i.e. does not rely on plug-ins or add-ons such as dos_lib or Express Tools): The question is: In AutoCAD 2004 how do you access the "Browse for Folder" dialog box that AutoCAD uses when (for example) browsing for a search path? Your help will be appreciated. -- Gary J. Orr CADD Administrator (218) 279-2421 Gary.Orr@LHBcorp.com LHB, Inc 21 West Superior Street, Suite 500 Duluth, Mn 55802 (218) 727-8446 www.LHBcorp.com
18 REPLIES 18
Message 2 of 19
Anonymous
in reply to: Anonymous

This has been posted already several times. But since you're having problem solving this, here's an example. (defun ALE_GetFolder ( / DirPat) (and (setq DirPat (getfiled "Browse for folder" "Open a folder and click on SAVE" " " 1 ) ) (setq DirPat (substr DirPat 1 (- (strlen DirPat) 4))) ) DirPat ) ;Adjust the flag value. -- Rudy@Cadentity.com AUTODESK Authorized Developer www.Cadentity.com MASi "Gary J. Orr" wrote in message news:40731c03$1_1@newsprd01... > I have spent the past hour searching the help files and the news groups but > still don't have a clean answer (i.e. does not rely on plug-ins or add-ons > such as dos_lib or Express Tools): > > The question is: > In AutoCAD 2004 how do you access the "Browse for Folder" dialog box that > AutoCAD uses when (for example) browsing for a search path? > > Your help will be appreciated. > > -- > Gary J. Orr > CADD Administrator > (218) 279-2421 > Gary.Orr@LHBcorp.com > > LHB, Inc > 21 West Superior Street, Suite 500 > Duluth, Mn 55802 > (218) 727-8446 > www.LHBcorp.com > >
Message 3 of 19
Anonymous
in reply to: Anonymous

I'm not sure. You know that could have been a nice thing to add in 2005. There haven't been any LISP additions to 2004 or 2005 that are substantial or usefull. Don't they realize there are still a boatload of people still using AutoLISP? I mean that is the reason their package got so popular in the first place. Even VBA is a pain in the but to do something like this. Oh well... "Gary J. Orr" wrote in message news:40731c03$1_1@newsprd01... > I have spent the past hour searching the help files and the news groups but > still don't have a clean answer (i.e. does not rely on plug-ins or add-ons > such as dos_lib or Express Tools): > > The question is: > In AutoCAD 2004 how do you access the "Browse for Folder" dialog box that > AutoCAD uses when (for example) browsing for a search path? > > Your help will be appreciated. > > -- > Gary J. Orr > CADD Administrator > (218) 279-2421 > Gary.Orr@LHBcorp.com > > LHB, Inc > 21 West Superior Street, Suite 500 > Duluth, Mn 55802 > (218) 727-8446 > www.LHBcorp.com > >
Message 4 of 19
Anonymous
in reply to: Anonymous

Sounds to me like you might be talking about the "getfiled" function, e.g. ^C^C-INSERT (getfiled "Select Drawing to Insert" "F:/" "dwg" 0) calls up a browse dialog box open to the root directory of drive F: to look for a drawing to insert. Or, there's the tilde (~) in response to a command-line prompt, e.g. -INSERT ~ brings up a browse dialog box. But maybe that's not what you're asking for. Kent Cooper, AIA "Gary J. Orr" wrote... > In AutoCAD 2004 how do you access the "Browse for Folder" dialog box that > AutoCAD uses when (for example) browsing for a search path? > Gary J. Orr
Message 5 of 19
Anonymous
in reply to: Anonymous

Rudy, I have seen this solution posted, but it isn't the solution that I'm asking for. This solution (I thing even originated by you?) relies on the user actually READING the dialog box. Unfortunately most of the issues that I end up resolving is the intermittent user not having read an instruction or options on a command line. There is a directory browser in the Express Tools suite (acet-ui-pickdir), but due to some ET installment glitches in our multi-platform/multiuser environment I can't rely on them being loaded. If I could extract it as a stand-alone *.lsp then load it if absent that would work. AutoCAD has a "Browse for Folder" dialog, I'm asking how to access it. Thank you for your response -- Gary J. Orr CADD Administrator (218) 279-2421 Gary.Orr@LHBcorp.com LHB, Inc 21 West Superior Street, Suite 500 Duluth, Mn 55802 (218) 727-8446 www.LHBcorp.com "Rudy Tovar" wrote in message news:4073322a_3@newsprd01... > This has been posted already several times. > > But since you're having problem solving this, here's an example. > > (defun ALE_GetFolder ( / DirPat) > (and > (setq DirPat > (getfiled > "Browse for folder" > "Open a folder and click on SAVE" " " 1 > ) > ) > (setq DirPat (substr DirPat 1 (- (strlen DirPat) 4))) > ) > DirPat > ) > > ;Adjust the flag value. > > -- > Rudy@Cadentity.com > AUTODESK > Authorized Developer > www.Cadentity.com > MASi > > > "Gary J. Orr" wrote in message > news:40731c03$1_1@newsprd01... > > I have spent the past hour searching the help files and the news groups > but > > still don't have a clean answer (i.e. does not rely on plug-ins or add-ons > > such as dos_lib or Express Tools): > > > > The question is: > > In AutoCAD 2004 how do you access the "Browse for Folder" dialog box that > > AutoCAD uses when (for example) browsing for a search path? > > > > Your help will be appreciated. > > > > -- > > Gary J. Orr > > CADD Administrator > > (218) 279-2421 > > Gary.Orr@LHBcorp.com > > > > LHB, Inc > > 21 West Superior Street, Suite 500 > > Duluth, Mn 55802 > > (218) 727-8446 > > www.LHBcorp.com > > > > > >
Message 6 of 19
Anonymous
in reply to: Anonymous

I've been trying to figure this out, but I guess I just don't understand what you're trying to do. In what way is it different from what AutoLisp's "getfiled" function does for you? Under what circumstances does a dialog box called "Browse for Folder" appear? I couldn't find it -- for example, in the first case I could think of off-hand where you might actually be looking for a folder, rather than a file, the dialog box that comes up when you pick "Browse" in the Xref Manager is called "Select new path." Is the one you refer to, wherever it is, any different from the regular file dialog box? If so, in what way? With "getfiled" you can have the dialog box that comes up titled any way you want (that's one of the terms in the function format), so you could force it to give you a file dialog box titled "Browse for Folder" like this example, if you want it within an button or pop or screen-menu Insert item: ^C^C-INSERT (getfiled "Browse for Folder" "" "dwg" 0) (Check out help for different things you can do with the last two terms.) Could it be that some custom routine, using language like this, is the source of this dialog box, and that in fact it's just a regular old file dialog box, but with a custom title? The "getfiled" function is supposed to work with any command asking for a file name or location, I think. Quoting from the AutoLisp Reference: "You can use this dialog box to browse through different drives and directories, select an existing file, or specify the name of a new file." Is what you're trying to do different from any of those choices (considering that "folders" and "directories" are the same thing)? Does your "Browse for Folder" dialog box do something that's not covered under "...browse through...directories" here? Kent Cooper, AIA "Gary J. Orr" wrote... > > AutoCAD has a "Browse for Folder" dialog, I'm asking how to access it. >
Message 7 of 19
Anonymous
in reply to: Anonymous

The short answer to your questions is Yes, it is a different dialog box. And Yes, I'm very familiar with the (getfiled) function, I use it all of the time. To see specific examples of two of the available "Browse for Folder" dialog boxes: From my last post There is a directory browser in the Express Tools suite (acet-ui-pickdir) To see this one (with Express Tools loaded) type the following at the command line: (acet-ui-pickdir) To see the one built into AutoCAD (from my original post): (for example) browsing for a search path? Here is a step by step for this example: Type OPTIONS at the command line: Select the FILES tab: Expand the SUPPORT FILE SEARCH PATH item: Select any of the path statements or hit the ADD Button: hit the BROWSE... Button: There's even another one in the Dos_lib suite floating around, but again, I'm looking for the built in one to prevent dependancy upon add-ons and plug-ins. Thanx again -- Gary J. Orr CADD Administrator (218) 279-2421 Gary.Orr@LHBcorp.com LHB, Inc 21 West Superior Street, Suite 500 Duluth, Mn 55802 (218) 727-8446 www.LHBcorp.com "Kent Cooper, AIA" wrote in message news:40741858_3@newsprd01... > I've been trying to figure this out, but I guess I just don't understand > what you're trying to do. In what way is it different from what AutoLisp's > "getfiled" function does for you? Under what circumstances does a dialog > box called "Browse for Folder" appear? I couldn't find it -- for example, > in the first case I could think of off-hand where you might actually be > looking for a folder, rather than a file, the dialog box that comes up when > you pick "Browse" in the Xref Manager is called "Select new path." Is the > one you refer to, wherever it is, any different from the regular file dialog > box? If so, in what way? > > With "getfiled" you can have the dialog box that comes up titled any way you > want (that's one of the terms in the function format), so you could force it > to give you a file dialog box titled "Browse for Folder" like this example, > if you want it within an button or pop or screen-menu Insert item: > > ^C^C-INSERT (getfiled "Browse for Folder" > " hes>" "dwg" 0) > > (Check out help for different things you can do with the last two terms.) > Could it be that some custom routine, using language like this, is the > source of this dialog box, and that in fact it's just a regular old file > dialog box, but with a custom title? > > The "getfiled" function is supposed to work with any command asking for a > file name or location, I think. Quoting from the AutoLisp Reference: > > "You can use this dialog box to browse through different drives and > directories, select an existing file, or specify the name of a new file." > > Is what you're trying to do different from any of those choices (considering > that "folders" and "directories" are the same thing)? Does your "Browse for > Folder" dialog box do something that's not covered under "...browse > through...directories" here? > > Kent Cooper, AIA > > "Gary J. Orr" wrote... > > > > AutoCAD has a "Browse for Folder" dialog, I'm asking how to access it. > > > >
Message 8 of 19
Anonymous
in reply to: Anonymous

Gary,

Autocad also has a really nice dialog box with which to select linetypes, but we can't fire it from AutoLISP.
if you write your application in ARX, your can use the fancy folder selection dialog box. if you use autolisp, you are constrained by certain factors.
i would suggest tackling your issue of ET installation "weirdness". one possible fix would be something like:
(if (not (member "ACET-UI-PICKDIR" (atoms-family 1))) (command "expresstools"))
or leverage a standard profile across all workstations.

--Jeremiah
Message 9 of 19
Anonymous
in reply to: Anonymous

Unfortunately the ARX is beyond me, I'm a dedicated lisper with just enough knowledge of VB/VBA and Windows scripting to be dangerous. leverage a standard profile across all workstations. If only . One of the mandated charters in our firm is supporting individual user customization. And, to be perfectly honest, I believe in that as well. I'm a supporter of anything that increases production levels. But that is a sidebar that I'd rather not follow. Anyway, I intend to tackle the install issue if I can't access the default AutoCAD version of the utility. You don't by any chance happen to know if the Express Tools "Browse for Folder" was ever a standalone function or if it could be extracted to make one? Thanx much for your time, -- Gary J. Orr CADD Administrator (218) 279-2421 Gary.Orr@LHBcorp.com LHB, Inc 21 West Superior Street, Suite 500 Duluth, Mn 55802 (218) 727-8446 www.LHBcorp.com "liftedaxis" wrote in message news:17272657.1081355413084.JavaMail.jive@jiveforum1.autodesk.com... > Gary, > > Autocad also has a really nice dialog box with which to select linetypes, but we can't fire it from AutoLISP. > if you write your application in ARX, your can use the fancy folder selection dialog box. if you use autolisp, you are constrained by certain factors. > i would suggest tackling your issue of ET installation "weirdness". one possible fix would be something like: > (if (not (member "ACET-UI-PICKDIR" (atoms-family 1))) (command "expresstools")) > or leverage a standard profile across all workstations. > > --Jeremiah
Message 10 of 19
Anonymous
in reply to: Anonymous

using the getfiled dialog would require a file to exist in the dir
much like the xref browse for path button. from there you
would have to strip out the file name like one of the posts
above mention (i believe it was rudy). the browse button in
the config is done in VBA i think, i tried to figure out how to
call it in lsp at one point and gave up after finding out about
the ACET-UI-PICKDIR feature, it uses the same dialog box.

the one in the dos_lib has an added feature with the create
folder button, but i see no way of turning the button off when
it isn't needed.

i would agree with the post above in taking the time to make
ET work on your machines, there are other good features to
use in your programs.
Message 11 of 19
Anonymous
in reply to: Anonymous

Take a look at the file "COMMON DIALOGS" in my web page - I just put it there. Dialogs: Open/save Browse for folder Note: Files are in alphabetic order. HTH. -- Download from my freeones page: Source code, VLISP, active-x, reactors, etc. and custom commands from http://www.draftteam.com
Message 12 of 19
Anonymous
in reply to: Anonymous

Louis, Thank you for your utilities. They are definately up to the task, however since they require installation (for registration of the dll's) I will probably skip this option. Since we have the express tools (or at least for this release) I'll work on verifying and/or reinstalling them (if required). Again, Thanx for your solution and I recommend either this or dos_lib for anyone that wants to install add-ons. -- Gary J. Orr CADD Administrator (218) 279-2421 Gary.Orr@LHBcorp.com LHB, Inc 21 West Superior Street, Suite 500 Duluth, Mn 55802 (218) 727-8446 www.LHBcorp.com "Luis Esquivel" wrote in message news:40743539_1@newsprd01... > Take a look at the file "COMMON DIALOGS" in my web page - I just put it > there. > > Dialogs: > Open/save > Browse for folder > > Note: Files are in alphabetic order. > > HTH. > > -- > Download from my freeones page: Source code, VLISP, active-x, reactors, etc. > and custom commands > from http://www.draftteam.com > >
Message 13 of 19
Anonymous
in reply to: Anonymous

I was really hoping that in R2006 we would FINALLY have a browse-for-folder method in Visual LISP. Isn't the number of posts and constant interest in this feature compelling enough for Autodesk to finally deliver this to us? I know there are those of you out there who see no need for it. I know there are those of you who have found ways around the issue that are acceptable to you. I'm not talking to you. I'm speaking to Autodesk and for those of us who want to have consistency in our GUI. I want my users to see the same Browse for Folder dialog that they are accustomed to seeing when I ask them to browse for a folder. I can't see that this is a moumental task.

[Read with tongue-in-cheek]
I even have a suggested solution. Take the guy (or gal) who had time to write that totally useless zoom effect for R2006 and put him/her to work on this task. I bet it could even be ready for R2006 SP1.

Just my 2 cents worth.

Stephen L. Bowen
President, PowerLISP Solutions
www.powerlisp.com
Message 14 of 19
Anonymous
in reply to: Anonymous

Well in 2006 i was hoping(command "xref" "overlay" could have an "initdia" option available.
No matter how I use xref from lisp I get errors when I try browsing to outside folders. This really should be available in lisp without writing a the huge work arounds I've seen so far. Mainly I keep thinking it will be broken in the next version again so they can build it as an add on to buy =(
Message 15 of 19
Anonymous
in reply to: Anonymous

I can use
(progn
(initdia)
(command "_.xref")
(while (> (getvar "cmdactive") 0)
(command pause)
)
)

And it works fine for me.

--

Tim
"A blind man lets nothing block his vision."



wrote in message news:5154383@discussion.autodesk.com...
Well in 2006 i was hoping(command "xref" "overlay" could have an "initdia"
option available.
No matter how I use xref from lisp I get errors when I try browsing to
outside folders. This really should be available in lisp without writing a
the huge work arounds I've seen so far. Mainly I keep thinking it will be
broken in the next version again so they can build it as an add on to buy =(
Message 16 of 19
Anonymous
in reply to: Anonymous

Thank you,
Pardon my flippant remark, I've got an issue with a current custom legacy routine that is causing the problem.

Best regards
Message 17 of 19
Anonymous
in reply to: Anonymous

is it possible to pull from the _.xref or xattach dialog then lisp the settings for a relative path & scale regardless of what the dialog had set already?
Message 18 of 19
Anonymous
in reply to: Anonymous

Try this:

; Sample:
; (Browse-To-Folder "Select Folder:" 0 "")
; (Browse-To-Folder "Select Folder or create new:" 64 "")
; (Browse-To-Folder "Select Folder on C:" 0 "C:\\")

(defun Browse-To-Folder ( DTEXT DFLG DDIR / ret y )
(vl-load-com)
(setq y (vlax-get-or-create-object "shell.application"))
(if (setq ret (vlax-invoke y "BrowseForFolder" 0 DTEXT DFLG DDIR))
(setq ret (vlax-get (vlax-get ret "Self") "Path"))
);_if
(vlax-release-object y)
ret
);_defun
Message 19 of 19
scot-65
in reply to: Anonymous

2/23/2024
This is the first post I came across when doing a keyword search "Browse for Directory".

AutoCAD R2024 LT
(vlax-get-or-create-object "shell.application") does not work in R2024-LT
Express tools and the dos lib do not exist either.

For those of you looking for an alternative or to tweak GETFILED, try this:
(vl-filename-directory (getfiled "Specify Destination Directory" (strcat (getvar "DWGPREFIX") (vl-filename-base (getvar "DWGNAME"))) "pdf" 32))

For my situation this will be used as part of a pre-publish dialog where the user will select a sub-directory within the main project's directory - therefore the "pdf" name.

Hope this helps.

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


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

Post to forums  

Forma Design Contest


Autodesk Design & Make Report