Add folders to open dialog
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Add folders to open dialog

 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization
Author Message
T.Willey
Guest





Posted: Fri Dec 17, 2004 10:02 pm    Post subject: Add folders to open dialog Reply with quote

You know when you go to open, the is a list of folders on the left hand side. I had folders there once, but not anymore. I was wondering if you could place stuff there within code? I have seen routines to removes stuff, like the buzzsaw folder, and other ACAD default folders, but never saw one to add folders. I have tried on my own and failed. I don't even think I have the code that I tried around anymore, but if someone could point me in the right direction, then I can do the research.

Thanks in advance, any help is appreciated.
Tim

Back to top
Josh
Guest





Posted: Sat Dec 18, 2004 1:09 am    Post subject: Re: Add folders to open dialog Reply with quote

Basically, (for each profile you have) it's a matter of three of registry
entries for each item you want displayed. Using Jimmy Bergmark's
http://www.jtbworld.com/download/remicons.lsp and by simply right-clicking
in the left bar and selecting "Add current folder" I was able to figure how
to do it....I just haven't written anything based on what learned.

The registry entries are located at
HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R15.0\<product-key>\Profiles\<yo
ur profile>\Dialogs\AllAnavDialogs

You can also do the same thing to Word but it's a bit more involved....
http://www.jsifaq.com/SUBF/tip2500/rh2591.htm

AND you can do the same thing to Window's Common dialog box...
http://www.jsifaq.com/SUBF/tip2500/rh2514.htm

One cool thing about Word is that you can make it use small icons.

Hopefully, this is enough info for you to get started...

Josh


"T.Willey" <nospam@address.withheld> wrote in message
news:27281913.1103303008244.JavaMail.jive@jiveforum2.autodesk.com...
Quote:
You know when you go to open, the is a list of folders on the left hand
side. I had folders there once, but not anymore. I was wondering if you

could place stuff there within code? I have seen routines to removes stuff,
like the buzzsaw folder, and other ACAD default folders, but never saw one
to add folders. I have tried on my own and failed. I don't even think I
have the code that I tried around anymore, but if someone could point me in
the right direction, then I can do the research.
Quote:

Thanks in advance, any help is appreciated.
Tim
Back to top
T.Willey
Guest





Posted: Sat Dec 18, 2004 1:22 am    Post subject: Re: Add folders to open dialog Reply with quote

Thanks for the info. When I get a chance will drive in.

Tim

Back to top
T.Willey
Guest





Posted: Wed Dec 22, 2004 3:47 am    Post subject: Re: Add folders to open dialog Reply with quote

With your help Josh and a little digging I got it to work. Here is the code. The only thing is I couldn't get rid of some of the other icons, but then you can get the remicons.lsp for the link you provided to do that.

If anyone wants to use this, just change the list of folders at the begining to the ones you want.

Tim

(defun c:AddFolderOpen (/ Fld2Add CurPro RegKey RegList ValList ValListDia DiaLOad
RtnList NmOpt ProCol NewPro cnt1 cnt2 len1)
;|
Adds a new profile (so you don't lose yours), based on the current one. Makes it
current, then prompts you to select what folders you want to keep from your current
open dialog box. Then it adds the new ones listed in the variable "Fld2Add" in order
that you listed them, with the old ones last. Make the list in the order of
"folder path" "name to show in dialog box" then double double quotes ("").
By Timothy Willey Dec. 2004
Provided as is. Tested one A2k4. Use at own risk.
|;

(setq Fld2Add
(reverse
(list
(list "C:\\Custom\\Drawings" "Custom" "")
(list "H:\\eMatrix\\Facilities" "Facilities" "")
(list "C:\\ACADSUPP2004\\Template" "TitleBlocks" "")
)
)
)
(setq ProCol (vla-get-Profiles (vla-get-Preferences (vlax-get-ACAD-Object))))
(setq CurPro (vla-get-ActiveProfile ProCol))
(while (or (not NmOpt) (= NmOpt "N"))
(setq NewPro (getstring T"\n Enter new profile name: "))
(if (member NewPro (GetAllProfileNames))
(progn
(initget "N Y")
(setq NmOpt (getkword (strcat "\n " NewPro " profile already exist. Save over it [<N>o Yes]: ")))
)
(setq NmOpt "Y")
)
)
(if (/= CurPro NewPro)
(vlax-invoke-method ProCol 'CopyProfile CurPro NewPro)
)
(vla-put-ActiveProfile ProCol NewPro)
(setq RegKey
(strcat "HKEY_CURRENT_USER\\"
(vlax-product-key)
"\\Profiles\\"
NewPro
"\\Dialogs\\AllAnavDialogs"
)
)
(setq RegList (vl-sort (vl-registry-descendents RegKey "PlacesOrder") '<))
(foreach item RegList
(setq ValList (cons (vl-registry-read RegKey item) ValLIst))
)
(setq ValList (reverse ValList))
(setq cnt1 0)
(setq len1 (1- (length ValList)))
(while (<= cnt1 len1)
(if (zerop (rem cnt1 3))
(setq ValListDia (cons (nth (1+ cnt1) ValList) ValListDia))
)
(setq cnt1 (1+ cnt1))
)
(setq ValListDia (reverse ValListDia))
(setq DiaLoad (load_dialog "CloseDwg.dcl"))
(if (not (new_dialog "MultiSelect" DiaLoad))
(exit)
)
(mode_tile "toggle1" 1)
(set_tile "text1" "Select folders to keep.")
(start_list "listbox" 3)
(mapcar 'add_list ValListDia)
(end_list)
(action_tile "accept"
"(progn
(setq RtnList (get_tile \"listbox\"))
(done_dialog 1)
)"
)
(action_tile "cancel" "(done_dialog 0)")
(if (= (start_dialog) 1)
(progn
(setq RtnList (read (strcat "(" RtnList ")")))
(foreach item RtnList
(setq cnt1 (1+ (* 3 item))
cnt2 (1+ cnt1)
)
(setq Fld2Add
(cons
(list
(nth (* 3 item) ValList)
(nth cnt1 ValList)
(nth cnt2 ValList)
)
Fld2Add
)
)
)
(foreach item RegList
(vl-registry-delete RegKey item)
)
(setq cnt1 0)
(foreach item (reverse Fld2Add)
(vl-registry-write RegKey (strcat "PlacesOrder" (itoa cnt1)) (car item))
(vl-registry-write RegKey (strcat "PlacesOrder" (itoa cnt1) "Display") (cadr item))
(vl-registry-write RegKey (strcat "PlacesOrder" (itoa cnt1) "Ext") (caddr item))
(setq cnt1 (1+ cnt1))
)
)
(progn
(vla-put-ActiveProfile ProCol CurPro)
(vlax-invoke-method ProCol 'DeleteProfile NewPro)
)
)
(princ)
)

;----------------------------------------

(defun getallprofilenames (/ allprofiles)
;;; By Jimmy Bergmark
;;; Copyright (C) 1997-2003 JTB World, All Rights Reserved
;;; Website: www.jtbworld.com
;;; E-mail: info@jtbworld.com
;;; Taken for "remicons.lsp"

(vla-getallprofilenames
(vla-get-profiles
(vla-get-preferences (vlax-get-acad-object))
)
'allprofiles
)
(vlax-safearray->list allprofiles)
)

And the dcl I used. Save as "CloseDwg.dcl"

MultiSelect : dialog{
label = "Select Item";
: list_box {
key = "listbox";
width = 55;
height = 25;
multiple_select = true;
}
: toggle {
key = "toggle1";
}
: text {
key = "text1";
}
: row {
: spacer { width = 1; }

: button { // defines the OK button
label = "OK";
is_default = true;
allow_accept = true;
key = "accept";
width = 8;
fixed_width = true;
}

: button { // defines the Cancel button
label = "Cancel";
is_cancel = true;
key = "cancel";
width = 8;
fixed_width = true;
}

: spacer { width = 1;}
}

}
Back to top
Josh
Guest





Posted: Wed Dec 22, 2004 5:50 am    Post subject: Re: Add folders to open dialog Reply with quote

Cool....glad I could help.

Josh
Back to top
GaryDF
Guest





Posted: Thu Dec 23, 2004 9:44 pm    Post subject: Re: Add folders to open dialog Reply with quote

Tim

In your routine I get an error whenever the list returned contains a nil
(setq ValListDia (reverse ValListDia)) gives me ("History" "My Documents"
"Favorites" "FTP" "Desktop" "Buzzsaw" nil)

so i just used the following:
(setq ValListDia '("History" "My Documents" "Favorites" "FTP" "Desktop"
"Buzzsaw"l))

..........................
Anyway this is what I have been using:

Gary
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AllAnavDialogs Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;
;;;(vlax-product-key) = "Software\\Autodesk\\AutoCAD\\R16.1\\ACAD-301:409"
;;;(getvar "CPROFILE") = "<<Unnamed Profile>>"
;;;
;;;useage (ARCH:AddIcons "PlacesOrder0" "V:\\ARCH" "PlacesOrder0Display" "ARCH")
;;;
(defun ARCH:AddIcons (podn path podp pnam / prof profiles regkey)
(vl-load-com)
;;; by Jimmy Bergmark from "remicons.lsp"
(defun getallprofilenames (/ allprofiles)
(vla-getallprofilenames
(vla-get-profiles
(vla-get-preferences (vlax-get-acad-object))
)
'allprofiles
)
(vlax-safearray->list allprofiles)
)
(setq profiles (getallprofilenames))
(if (not allprof) (setq profiles (list (getvar "CPROFILE"))))
(foreach prof profiles
(progn
(setq regkey (strcat "HKEY_CURRENT_USER\\" (vlax-product-key)
"\\Profiles\\" prof "\\Dialogs\\AllAnavDialogs\\"))
(vl-registry-write regkey podn path)
(vl-registry-write regkey podp pnam)
)
)
(princ)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AllAnavDialogs Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;
(defun ARCH:AllAnavDialogs-Default (/ Result)
(setq Result (ARCH:WARNING-5
"Restore AutoCAD Default Browser Folders"
" This Will Restore the Original Default AutoCAD\n"
" Browser Folders.\n\n" " [ Yes ]\t to continue
on...\n"
" [ No ]\t Do NOT Restore." ""))
(cond ((= Result 1)
(princ "\n*** ///////// Program CANCELLED ///////// ***"))
((= Result 0)
(ARCH:AddIcons "PlacesOrder0" "History" "PlacesOrder0Display" "History")
(ARCH:AddIcons
"PlacesOrder1"
"Personal"
"PlacesOrder1Display"
"My Documents")
(ARCH:AddIcons
"PlacesOrder2"
"Favorites"
"PlacesOrder2Display"
"Favorites")
(ARCH:AddIcons "PlacesOrder3" "FTPSites" "PlacesOrder3Display" "FTP")
(ARCH:AddIcons "PlacesOrder4" "Desktop" "PlacesOrder4Display" "Desktop")
(ARCH:AddIcons
"PlacesOrder5"
"ACPROJECT"
"PlacesOrder5Display"
"Buzzsaw")
(menucmd "GARCH.ID_ACAR=~")
(menucmd "GARCH.ID_ARCH=")
(princ "\n* AutoCAD Default Browser Folders Restored *")))
(princ))
;;;
(defun ARCH:AllAnavDialogs-Jobs (/ Result)
(setq Result (ARCH:WARNING-5
"Add Arch and Job Folders to Browser Folders"
" This will add Arch Folder and Job Folders\n"
" Job Folders Added: 2001 2002 2003 2004 2005\n\n"
" [ Yes ]\t to continue on...\n" " [ No ]\t Do NOT Add
Folders." ""))
(cond ((= Result 1)
(princ "\n*** ///////// Program CANCELLED ///////// ***"))
((= Result 0)
(ARCH:AddIcons "PlacesOrder0" "V:\\Arch" "PlacesOrder0Display" "Arch")
(ARCH:AddIcons
"PlacesOrder1"
"F:\\JOBS\\2001"
"PlacesOrder1Display"
"2001")
(ARCH:AddIcons
"PlacesOrder2"
"F:\\JOBS\\2002"
"PlacesOrder2Display"
"2002")
(ARCH:AddIcons
"PlacesOrder3"
"F:\\JOBS\\2003"
"PlacesOrder3Display"
"2003")
(ARCH:AddIcons
"PlacesOrder4"
"F:\\JOBS\\2004"
"PlacesOrder4Display"
"2004")
(ARCH:AddIcons
"PlacesOrder5"
"F:\\JOBS\\2005"
"PlacesOrder5Display"
"2005")
(menucmd "GARCH.ID_ARCH=~")
(menucmd "GARCH.ID_ACAR=")
(princ "\n* Arch and Job Folders to Browser Folders Added *")))
(princ))
;;;
(defun ARCH:AllAnavDialogs-Read ()
(cond ((= (vl-registry-read
(strcat "HKEY_CURRENT_USER\\"
(vlax-product-key)
"\\Profiles\\"
(getvar "CPROFILE")
"\\Dialogs\\AllAnavDialogs")
"PlacesOrder0Display")
"Arch")
(progn (menucmd "GARCH.ID_ARCH=~") (menucmd "GARCH.ID_ACAR=")))
((/= (vl-registry-read
(strcat "HKEY_CURRENT_USER\\"
(vlax-product-key)
"\\Profiles\\"
(getvar "CPROFILE")
"\\Dialogs\\AllAnavDialogs")
"PlacesOrder0Display")
"Arch")
(progn (menucmd "GARCH.ID_ARCH=") (menucmd "GARCH.ID_ACAR=~"))))
(cond ((= (vl-registry-read
(strcat "HKEY_CURRENT_USER\\"
(vlax-product-key)
"\\Profiles\\"
(getvar "CPROFILE")
"\\Dialogs\\AllAnavDialogs")
"PlacesOrder5Display")
"Buzzsaw")
(menucmd "GARCH.ID_ACAD="))
((/= (vl-registry-read
(strcat "HKEY_CURRENT_USER\\"
(vlax-product-key)
"\\Profiles\\"
(getvar "CPROFILE")
"\\Dialogs\\AllAnavDialogs")
"PlacesOrder5Display")
"Buzzsaw")
(menucmd "GARCH.ID_ACAD=~")))
;;(menucmd "GARCH.ID_ARCH=~")
;;(menucmd "GARCH.ID_ACAD=~")
;;(menucmd "GARCH.ID_ACAR=~")
(princ))



"T.Willey" <nospam@address.withheld> wrote in message
news:10058792.1103669290763.JavaMail.jive@jiveforum2.autodesk.com...
Quote:
With your help Josh and a little digging I got it to work. Here is the code.
The only thing is I couldn't get rid of some of the other icons, but then you can

get the remicons.lsp for the link you provided to do that.
Quote:

If anyone wants to use this, just change the list of folders at the begining to
the ones you want.

Tim

(defun c:AddFolderOpen (/ Fld2Add CurPro RegKey RegList ValList ValListDia
DiaLOad
RtnList NmOpt ProCol NewPro cnt1 cnt2 len1)
;|
Adds a new profile (so you don't lose yours), based on the current one.
Makes it
current, then prompts you to select what folders you want to keep from your
current
open dialog box. Then it adds the new ones listed in the variable "Fld2Add"
in order
that you listed them, with the old ones last. Make the list in the order of
"folder path" "name to show in dialog box" then double double quotes ("").
By Timothy Willey Dec. 2004
Provided as is. Tested one A2k4. Use at own risk.
|;

(setq Fld2Add
(reverse
(list
(list "C:\\Custom\\Drawings" "Custom" "")
(list "H:\\eMatrix\\Facilities" "Facilities" "")
(list "C:\\ACADSUPP2004\\Template" "TitleBlocks" "")
)
)
)
(setq ProCol (vla-get-Profiles (vla-get-Preferences (vlax-get-ACAD-Object))))
(setq CurPro (vla-get-ActiveProfile ProCol))
(while (or (not NmOpt) (= NmOpt "N"))
(setq NewPro (getstring T"\n Enter new profile name: "))
(if (member NewPro (GetAllProfileNames))
(progn
(initget "N Y")
(setq NmOpt (getkword (strcat "\n " NewPro " profile already exist. Save
over it [<N>o Yes]: ")))
)
(setq NmOpt "Y")
)
)
(if (/= CurPro NewPro)
(vlax-invoke-method ProCol 'CopyProfile CurPro NewPro)
)
(vla-put-ActiveProfile ProCol NewPro)
(setq RegKey
(strcat "HKEY_CURRENT_USER\\"
(vlax-product-key)
"\\Profiles\\"
NewPro
"\\Dialogs\\AllAnavDialogs"
)
)
(setq RegList (vl-sort (vl-registry-descendents RegKey "PlacesOrder") '<))
(foreach item RegList
(setq ValList (cons (vl-registry-read RegKey item) ValLIst))
)
(setq ValList (reverse ValList))
(setq cnt1 0)
(setq len1 (1- (length ValList)))
(while (<= cnt1 len1)
(if (zerop (rem cnt1 3))
(setq ValListDia (cons (nth (1+ cnt1) ValList) ValListDia))
)
(setq cnt1 (1+ cnt1))
)
(setq ValListDia (reverse ValListDia))
(setq DiaLoad (load_dialog "CloseDwg.dcl"))
(if (not (new_dialog "MultiSelect" DiaLoad))
(exit)
)
(mode_tile "toggle1" 1)
(set_tile "text1" "Select folders to keep.")
(start_list "listbox" 3)
(mapcar 'add_list ValListDia)
(end_list)
(action_tile "accept"
"(progn
(setq RtnList (get_tile \"listbox\"))
(done_dialog 1)
)"
)
(action_tile "cancel" "(done_dialog 0)")
(if (= (start_dialog) 1)
(progn
(setq RtnList (read (strcat "(" RtnList ")")))
(foreach item RtnList
(setq cnt1 (1+ (* 3 item))
cnt2 (1+ cnt1)
)
(setq Fld2Add
(cons
(list
(nth (* 3 item) ValList)
(nth cnt1 ValList)
(nth cnt2 ValList)
)
Fld2Add
)
)
)
(foreach item RegList
(vl-registry-delete RegKey item)
)
(setq cnt1 0)
(foreach item (reverse Fld2Add)
(vl-registry-write RegKey (strcat "PlacesOrder" (itoa cnt1)) (car item))
(vl-registry-write RegKey (strcat "PlacesOrder" (itoa cnt1) "Display") (cadr
item))
(vl-registry-write RegKey (strcat "PlacesOrder" (itoa cnt1) "Ext") (caddr
item))
(setq cnt1 (1+ cnt1))
)
)
(progn
(vla-put-ActiveProfile ProCol CurPro)
(vlax-invoke-method ProCol 'DeleteProfile NewPro)
)
)
(princ)
)

;----------------------------------------

(defun getallprofilenames (/ allprofiles)
;;; By Jimmy Bergmark
;;; Copyright (C) 1997-2003 JTB World, All Rights Reserved
;;; Website: www.jtbworld.com
;;; E-mail: info@jtbworld.com
;;; Taken for "remicons.lsp"

(vla-getallprofilenames
(vla-get-profiles
(vla-get-preferences (vlax-get-acad-object))
)
'allprofiles
)
(vlax-safearray->list allprofiles)
)

And the dcl I used. Save as "CloseDwg.dcl"

MultiSelect : dialog{
label = "Select Item";
: list_box {
key = "listbox";
width = 55;
height = 25;
multiple_select = true;
}
: toggle {
key = "toggle1";
}
: text {
key = "text1";
}
: row {
: spacer { width = 1; }

: button { // defines the OK button
label = "OK";
is_default = true;
allow_accept = true;
key = "accept";
width = 8;
fixed_width = true;
}

: button { // defines the Cancel button
label = "Cancel";
is_cancel = true;
key = "cancel";
width = 8;
fixed_width = true;
}

: spacer { width = 1;}
}

}
Back to top
T.Willey
Guest





Posted: Thu Dec 23, 2004 9:59 pm    Post subject: Re: Add folders to open dialog Reply with quote

I noticed that also, so I fixed it, but didn't post the new version because there was no intrest. Here is the revised routine plus a return default routine.

Tim

(defun c:AddFolderOpen (/ Fld2Add CurPro RegKey RegList ValList ValListDia DiaLOad
RtnList NmOpt ProCol NewPro cnt1 cnt2 len1)
;|
Adds a new profile (so you don't lose yours), based on the current one. Makes it
current, then prompts you to select what folders you want to keep from your current
open dialog box. Then it adds the new ones listed in the variable "Fld2Add" in order
that you listed them, with the old ones last. Make the list in the order of
"folder path" "name to show in dialog box" then double double quotes ("").
By Timothy Willey Dec. 2004
Provided as is. Tested one A2k4. Use at own risk.
|;

(setq Fld2Add
(reverse
(list
(list "C:\\Custom\\Drawings" "Custom" "")
(list "H:\\eMatrix\\Facilities" "Facilities" "")
(list "H:\\eMatrix\\PICS" "PICS" "")
(list "C:\\ACADSUPP2004\\Template" "TitleBlocks" "")
)
)
)
(setq ProCol (vla-get-Profiles (vla-get-Preferences (vlax-get-ACAD-Object))))
(setq CurPro (vla-get-ActiveProfile ProCol))
(while (or (not NmOpt) (= NmOpt "N"))
(setq NewPro (getstring T"\n Enter new profile name [or enter to modify current profile]: "))
(if (member NewPro (GetAllProfileNames))
(progn
(initget "N Y")
(setq NmOpt (getkword (strcat "\n " NewPro " profile already exist. Save over it [<N>o Yes]: ")))
)
(setq NmOpt "Y")
)
)
(if (= NewPro "")
(setq NewPro CurPro)
)
(if (/= CurPro NewPro)
(vlax-invoke-method ProCol 'CopyProfile CurPro NewPro)
)
(vla-put-ActiveProfile ProCol NewPro)
(setq RegKey
(strcat "HKEY_CURRENT_USER\\"
(vlax-product-key)
"\\Profiles\\"
NewPro
"\\Dialogs\\AllAnavDialogs"
)
)
(setq RegList (vl-sort (vl-registry-descendents RegKey "PlacesOrder") '<))
(foreach item RegList
(setq ValList (cons (vl-registry-read RegKey item) ValLIst))
)
(setq ValList (reverse ValList))
(setq cnt1 0)
(setq len1 (1- (length ValList)))
(while (<= cnt1 len1)
(if (zerop (rem cnt1 3))
(setq ValListDia (cons (nth (1+ cnt1) ValList) ValListDia))
)
(setq cnt1 (1+ cnt1))
)
(setq ValListDia
(if (not (car ValListDia))
(reverse (cdr ValListDia))
(reverse ValListDia)
)
)
(setq DiaLoad (load_dialog "CloseDwg.dcl"))
(if (not (new_dialog "MultiSelect" DiaLoad))
(exit)
)
(mode_tile "toggle1" 1)
(set_tile "text1" "Select folders to keep.")
(start_list "listbox" 3)
(mapcar 'add_list ValListDia)
(end_list)
(action_tile "accept"
"(progn
(setq RtnList (get_tile \"listbox\"))
(done_dialog 1)
)"
)
(action_tile "cancel" "(done_dialog 0)")
(if (= (start_dialog) 1)
(progn
(setq RtnList (read (strcat "(" RtnList ")")))
(foreach item RtnList
(setq cnt1 (1+ (* 3 item))
cnt2 (1+ cnt1)
)
(setq Fld2Add
(cons
(list
(nth (* 3 item) ValList)
(nth cnt1 ValList)
(nth cnt2 ValList)
)
Fld2Add
)
)
)
(foreach item RegList
(vl-registry-delete RegKey item)
)
(setq cnt1 0)
(foreach item (reverse Fld2Add)
(vl-registry-write RegKey (strcat "PlacesOrder" (itoa cnt1)) (car item))
(vl-registry-write RegKey (strcat "PlacesOrder" (itoa cnt1) "Display") (cadr item))
(vl-registry-write RegKey (strcat "PlacesOrder" (itoa cnt1) "Ext") (caddr item))
(setq cnt1 (1+ cnt1))
)
)
(progn
(vla-put-ActiveProfile ProCol CurPro)
(vlax-invoke-method ProCol 'DeleteProfile NewPro)
)
)
(princ)
)

;----------------------------------------

(defun getallprofilenames (/ allprofiles)
;;; By Jimmy Bergmark
;;; Copyright (C) 1997-2003 JTB World, All Rights Reserved
;;; Website: www.jtbworld.com
;;; E-mail: info@jtbworld.com
;;; Taken for "remicons.lsp"

(vla-getallprofilenames
(vla-get-profiles
(vla-get-preferences (vlax-get-acad-object))
)
'allprofiles
)
(vlax-safearray->list allprofiles)
)

;================================================

(defun c:ReturnDefaultFolders (/ CurPro RegKey RegList DefaultList)
; Return default folders to open dialog for current profile
; By Timothy Willey Dec. 2004

(setq CurPro (getvar "cprofile"))
(setq RegKey
(strcat "HKEY_CURRENT_USER\\"
(vlax-product-key)
"\\Profiles\\"
CurPro
"\\Dialogs\\AllAnavDialogs"
)
)
(setq RegList (vl-registry-descendents RegKey "PlacesOrder"))
(foreach item RegList
(vl-registry-delete RegKey item)
)
(setq DefaultList
(list
(list "PlacesOrder0" "History")
(list "PlacesOrder0Display" "History")
(list "PlacesOrder0Ext" "")
(list "PlacesOrder1" "Personal")
(list "PlacesOrder1Display" "My Documents")
(list "PlacesOrder1Ext" "")
(list "PlacesOrder2" "Favorites")
(list "PlacesOrder2Display" "Favorites")
(list "PlacesOrder2Ext" "")
(list "PlacesOrder3" "Desktop")
(list "PlacesOrder3Display" "Desktop")
(list "PlacesOrder3Ext" "")
(list "PlacesOrder4" "ACPROJECT")
(list "PlacesOrder4Display" "Buzzsaw")
(list "PlacesOrder4Ext" "")
(list "PlacesOrder5" "FTPSites")
(list "PlacesOrder5Display" "FTP")
(list "PlacesOrder5Ext" "")
(list "PlacesOrder6" "")
)
)
(foreach item DefaultList
(vl-registry-write RegKey (car item) (cadr item))
)
(princ)
)
Back to top
GaryDF
Guest





Posted: Thu Dec 23, 2004 11:01 pm    Post subject: Re: Add folders to open dialog Reply with quote

I like it, will play around with it over the holidays.
I would modify it to create the dcl file on the fly,
if not found.

ARCH#SUPF = your path

something like:

(defun DCL_CloseDwg (/ dcl_list dcl_write)
(setq DCL_LIST
(list
"MultiSelect:dialog {label=\" Select Item\";
:list_box {key=\"listbox\"; width=25; height=9;
multiple_select=true;}
:text {key=\"text1\"; width=25;}
:row {
:spacer {}
:button {label=\"OK\"; is_default=true; allow_accept=true;
key=\"accept\"; width=8; fixed_width=true;}
:button {label=\"Cancel\"; is_cancel=true; key=\"cancel\"; width=8;
fixed_width=true;}
:spacer {}
}
}"))
(setq DCL_WRITE (open (strcat ARCH#SUPF "CloseDwg.dcl") "w"))
(foreach c DCL_LIST (princ c DCL_WRITE))
(close DCL_WRITE)
(princ)
)

Gary

"T.Willey" <nospam@address.withheld> wrote in message
news:9469966.1103821207815.JavaMail.jive@jiveforum1.autodesk.com...
Quote:
I noticed that also, so I fixed it, but didn't post the new version because
there was no intrest. Here is the revised routine plus a return default routine.

Tim

(defun c:AddFolderOpen (/ Fld2Add CurPro RegKey RegList ValList ValListDia
DiaLOad
RtnList NmOpt ProCol NewPro cnt1 cnt2 len1)
;|
Adds a new profile (so you don't lose yours), based on the current one.
Makes it
current, then prompts you to select what folders you want to keep from your
current
open dialog box. Then it adds the new ones listed in the variable "Fld2Add"
in order
that you listed them, with the old ones last. Make the list in the order of
"folder path" "name to show in dialog box" then double double quotes ("").
By Timothy Willey Dec. 2004
Provided as is. Tested one A2k4. Use at own risk.
|;

(setq Fld2Add
(reverse
(list
(list "C:\\Custom\\Drawings" "Custom" "")
(list "H:\\eMatrix\\Facilities" "Facilities" "")
(list "H:\\eMatrix\\PICS" "PICS" "")
(list "C:\\ACADSUPP2004\\Template" "TitleBlocks" "")
)
)
)
(setq ProCol (vla-get-Profiles (vla-get-Preferences (vlax-get-ACAD-Object))))
(setq CurPro (vla-get-ActiveProfile ProCol))
(while (or (not NmOpt) (= NmOpt "N"))
(setq NewPro (getstring T"\n Enter new profile name [or enter to modify
current profile]: "))
(if (member NewPro (GetAllProfileNames))
(progn
(initget "N Y")
(setq NmOpt (getkword (strcat "\n " NewPro " profile already exist. Save
over it [<N>o Yes]: ")))
)
(setq NmOpt "Y")
)
)
(if (= NewPro "")
(setq NewPro CurPro)
)
(if (/= CurPro NewPro)
(vlax-invoke-method ProCol 'CopyProfile CurPro NewPro)
)
(vla-put-ActiveProfile ProCol NewPro)
(setq RegKey
(strcat "HKEY_CURRENT_USER\\"
(vlax-product-key)
"\\Profiles\\"
NewPro
"\\Dialogs\\AllAnavDialogs"
)
)
(setq RegList (vl-sort (vl-registry-descendents RegKey "PlacesOrder") '<))
(foreach item RegList
(setq ValList (cons (vl-registry-read RegKey item) ValLIst))
)
(setq ValList (reverse ValList))
(setq cnt1 0)
(setq len1 (1- (length ValList)))
(while (<= cnt1 len1)
(if (zerop (rem cnt1 3))
(setq ValListDia (cons (nth (1+ cnt1) ValList) ValListDia))
)
(setq cnt1 (1+ cnt1))
)
(setq ValListDia
(if (not (car ValListDia))
(reverse (cdr ValListDia))
(reverse ValListDia)
)
)
(setq DiaLoad (load_dialog "CloseDwg.dcl"))
(if (not (new_dialog "MultiSelect" DiaLoad))
(exit)
)
(mode_tile "toggle1" 1)
(set_tile "text1" "Select folders to keep.")
(start_list "listbox" 3)
(mapcar 'add_list ValListDia)
(end_list)
(action_tile "accept"
"(progn
(setq RtnList (get_tile \"listbox\"))
(done_dialog 1)
)"
)
(action_tile "cancel" "(done_dialog 0)")
(if (= (start_dialog) 1)
(progn
(setq RtnList (read (strcat "(" RtnList ")")))
(foreach item RtnList
(setq cnt1 (1+ (* 3 item))
cnt2 (1+ cnt1)
)
(setq Fld2Add
(cons
(list
(nth (* 3 item) ValList)
(nth cnt1 ValList)
(nth cnt2 ValList)
)
Fld2Add
)
)
)
(foreach item RegList
(vl-registry-delete RegKey item)
)
(setq cnt1 0)
(foreach item (reverse Fld2Add)
(vl-registry-write RegKey (strcat "PlacesOrder" (itoa cnt1)) (car item))
(vl-registry-write RegKey (strcat "PlacesOrder" (itoa cnt1) "Display") (cadr
item))
(vl-registry-write RegKey (strcat "PlacesOrder" (itoa cnt1) "Ext") (caddr
item))
(setq cnt1 (1+ cnt1))
)
)
(progn
(vla-put-ActiveProfile ProCol CurPro)
(vlax-invoke-method ProCol 'DeleteProfile NewPro)
)
)
(princ)
)

;----------------------------------------

(defun getallprofilenames (/ allprofiles)
;;; By Jimmy Bergmark
;;; Copyright (C) 1997-2003 JTB World, All Rights Reserved
;;; Website: www.jtbworld.com
;;; E-mail: info@jtbworld.com
;;; Taken for "remicons.lsp"

(vla-getallprofilenames
(vla-get-profiles
(vla-get-preferences (vlax-get-acad-object))
)
'allprofiles
)
(vlax-safearray->list allprofiles)
)

;================================================

(defun c:ReturnDefaultFolders (/ CurPro RegKey RegList DefaultList)
; Return default folders to open dialog for current profile
; By Timothy Willey Dec. 2004

(setq CurPro (getvar "cprofile"))
(setq RegKey
(strcat "HKEY_CURRENT_USER\\"
(vlax-product-key)
"\\Profiles\\"
CurPro
"\\Dialogs\\AllAnavDialogs"
)
)
(setq RegList (vl-registry-descendents RegKey "PlacesOrder"))
(foreach item RegList
(vl-registry-delete RegKey item)
)
(setq DefaultList
(list
(list "PlacesOrder0" "History")
(list "PlacesOrder0Display" "History")
(list "PlacesOrder0Ext" "")
(list "PlacesOrder1" "Personal")
(list "PlacesOrder1Display" "My Documents")
(list "PlacesOrder1Ext" "")
(list "PlacesOrder2" "Favorites")
(list "PlacesOrder2Display" "Favorites")
(list "PlacesOrder2Ext" "")
(list "PlacesOrder3" "Desktop")
(list "PlacesOrder3Display" "Desktop")
(list "PlacesOrder3Ext" "")
(list "PlacesOrder4" "ACPROJECT")
(list "PlacesOrder4Display" "Buzzsaw")
(list "PlacesOrder4Ext" "")
(list "PlacesOrder5" "FTPSites")
(list "PlacesOrder5Display" "FTP")
(list "PlacesOrder5Ext" "")
(list "PlacesOrder6" "")
)
)
(foreach item DefaultList
(vl-registry-write RegKey (car item) (cadr item))
)
(princ)
)
Back to top
T.Willey
Guest





Posted: Thu Dec 23, 2004 11:37 pm    Post subject: Re: Add folders to open dialog Reply with quote

True, but I have only a few dcl files that I use here, and I am the only cad person where I work. Change it to suit you needs. I just got tired of after something happens and I loose those folders.

Happy Holidays.
Tim
Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB