Modify "Support File Search Path" in Options outside of AutoCAD

Modify "Support File Search Path" in Options outside of AutoCAD

EATREVITPOOPCAD
Collaborator Collaborator
1,871 Views
9 Replies
Message 1 of 10

Modify "Support File Search Path" in Options outside of AutoCAD

EATREVITPOOPCAD
Collaborator
Collaborator

Hello people,

 

I am making a simple program that will create a folder on the C: Drive called AutoLisp and then places a few AutoLisps in that folder.

 

The next step I am having an issue with... I need to access Support File Search Path in Options menu, and add the newly created directory "C:\AutoLisp"

 

How can I do that from outside of AutoCAD? Is there some INI, XML, or other file type that contains the support directories? Maybe its in the windows registry?

 

Thank you for your time 😄

 

 

 

The definition of insanity is doing the same thing over and over again and expecting different results
0 Likes
Accepted solutions (2)
1,872 Views
9 Replies
Replies (9)
Message 2 of 10

john.uhden
Mentor
Mentor

@EATREVITPOOPCAD 

It is in the registry, but I don't know how to mess with that outside of AutoCAD.

Maybe you can do it from REVIT.

BTW, if you're going to add a new path, make sure it's a TrustedPath.

But why must you do your thing from outside AutoCAD?  Does it give you the runs or cause constipation?

John F. Uhden

0 Likes
Message 3 of 10

EATREVITPOOPCAD
Collaborator
Collaborator

It goes right through me, but that’s a good thing. Love making money while in the toilet. 

JK (not about about making money on the toilet) don’t judge me by the name, half of my work in is in AutoCAD 😅

 

I would like to do this outside of AutoCAD because I want to create a one click single file executable that installs a few of my AutoLISP routines. I want to dumb it down so that nothing is required from user do to after clicking to install.

 

Plan: extract to a new directory and modify registry to include that directory.

 

Thanks for letting me know about trusted paths… never heard of them. I will look into it.

 

I will look for where this is located in registry next week and I’ll post my findings.

 

 

 

The definition of insanity is doing the same thing over and over again and expecting different results
0 Likes
Message 4 of 10

john.uhden
Mentor
Mentor
Accepted solution

@EATREVITPOOPCAD 

Well, you can do it all from within AutoCAD using acaddoc.lsp which automatically loads with every new or opening.

You can put in it whatever you want... loading other lisps and ARXs, importing a profile, sending an alert, setting up reactors, whatever.  And it's your choice whether you advise the user of anything or not.  Today's computers are so fast (except my own) that blinking an eye can make you miss an operation on hundreds of objects.

For example, at my only remaining client's site I set up an auto-update function to compare the date/time of what's installed on their machine to the same file name on their server and to install the newer one and/or anything new.  Also a reactor to keep a log of how much time is spent on a drawing and an interactive dialog for them to report the status which gets pugged into a spread sheet on the server so the boss/manager can track progress.  Of course its value is limited because all the login names are the same, but at least I can identify the computer name, and the CAD techs rarely change seats.

John F. Uhden

Message 5 of 10

Sea-Haven
Mentor
Mentor

I wrote a install lisp for just this purpose it makes a directory if not exist, adds the paths and updates the menu. Just ask user to drag and drop the install lisp on to CAD, it then asks for the zip file to use that matches the install.lsp. This was done this way as the end user recieves a email with 2 files ZIP and LSP.

 

The powershell unzips a handy tool.

 

; install program by AlanH 
; Looks for a ZIP file with all the following in it
; MNU MNL SCR LSP CUI CUIX GIF and so on

(defun XXXinstall ( / *files* filename newpath oldtrust paths menu_path menu_name Group_name)
(vl-load-com)
(vl-mkdir "c:\\XXX-CAD-TOOLS")

(setq filename (getfiled "Select the File \"XXX-AlanH-Mar-2022\"" "" "ZIP" 16))

; unzip
(startapp (strcat "powershell -command Expand-Archive -Path '" filename "' -DestinationPath 'C:/XXX-CAD-TOOLS'"))
(alert "programs unzipped to C:/XXX-CAD-TOOLS")

(setq *files*  (vla-get-files  (vla-get-preferences (vlax-get-Acad-object))))
(setq paths (vla-get-SupportPath *files*))
(if (wcmatch  paths "*XXX*")
(princ)
(vla-put-SupportPath *files* (strcat "C:\\XXX-CAD-TOOLS" ";" paths))
)

(if  (> (vl-string-search  "BricsCAD" (getvar 'acadver)) 0)
(princ "Bricscad") 
(progn
(setq oldtrust (getvar 'trustedpaths))
(if (wcmatch  oldtrust "*XXX*")
(princ)
(setvar 'trustedpaths (strcat oldtrust ";" "c:\\XXX-CAD-TOOLS"))
)
)
)

(alert "\nSupport and trusted paths added")

(setq Menu_Path "C:\\XXX-CAD-TOOLS\\"); Path to Menu file
(setq Menu_Name "XXX-CAD-TOOLS"); pop menu to load
(setq Group_Name "XXXMENU"); groupname assigned in .mnu or .mns file

(if (menugroup menu_Name)
(command "_MENUUNLOAD" menu_Name)
)

(if  (> (vl-string-search  "BricsCAD" (getvar 'acadver)) 0)
(progn
(command "MENULOAD" (strcat Menu_Path Menu_Name ".CUI"))
(menucmd (strcat "P20=+" menu_Name ".POP1"))
)
(progn
(setq cnt (vla-get-count(vla-get-menuGroups (vlax-get-acad-object))))
(command "MENULOAD" (strcat Menu_Path Menu_Name))
(menucmd (strcat "P" (rtos (+ cnt 1) 2 0) "=+" menu_Name ".POP1"))
)
)

(alert "\n Menu loaded \n \n XXX AlanH programs now installed")

)
(XXXinstall)

 

Message 6 of 10

EATREVITPOOPCAD
Collaborator
Collaborator

@Sea-Haven this is very cool thank you for sharing! 

 

@john.uhden acaddoc.lsp is the way to go for me I think. I just didn't want to litter the C drive by placing the acaddoc.lsp in support directories of AutoCAD versions that may not be installed. I want the AutoLisp routines to be setup for AutoCAD versions from 2018 to 2023.

 

What I am doing:

  • EXE file
    • will extract AutoLisp1.lsp, AutoLisp2.lsp, AutoLisp3.lsp into C:\Lisp\
    • For each AutoCAD versions: 2018, 2019, 2020, 2021, 2022 & and 2023
      • in one of the supported file paths see if acaddoc.lsp exists
        • if it does not, create it with the 3 Lisp paths
        • if it does, append the 3 Lisp paths to it

I believe if the .LSP are digitally signed, they shouldn't display any messages @ load either. 

 

 

As far as this last client, I do appreciate their focus on technology but that seems like a lot of micro tracking...

The definition of insanity is doing the same thing over and over again and expecting different results
0 Likes
Message 7 of 10

Sea-Haven
Mentor
Mentor

You dont need acaddoc if your saving all your lisps plus menus etc to c:\lisp

 

Re read the bit in my code about paths, you run it once for the support paths once set its done. You should not need to load every time.

 

I have been using setpaths.lsp that does way more plotters, logfiles, tempfiles and so on, when I updated autocad ran setpaths.lsp once and all done for the user we had 8 copies. The other thing we did was reload the users toolbar preferences these were aindividual script as each user liked different toolbars.

 

I have spent way to many years never touching acaddoc.lsp etc always loading custom routines.

Message 8 of 10

EATREVITPOOPCAD
Collaborator
Collaborator

@Sea-Haven I played with the routine, and it successfully unzips my LSP to the C drive. However, I was not able to load the routine. acaddoc.lsp inside the zip file would solve this issue, but now I am curious how to go without it? I am only looking to load just LSP files so cut the bottom part of the code out ( I tried without cutting it)

 

; install program by AlanH 
; Looks for a ZIP file with all the following in it
; MNU MNL SCR LSP CUI CUIX GIF and so on

(defun XXXinstall ( / *files* filename newpath oldtrust paths menu_path menu_name Group_name)
(vl-load-com)
(vl-mkdir "c:\\XXX-CAD-TOOLS")

(setq filename (getfiled "Select the File \"XXX-AlanH-Mar-2022\"" "" "ZIP" 16))

; unzip
(startapp (strcat "powershell -command Expand-Archive -Path '" filename "' -DestinationPath 'C:/XXX-CAD-TOOLS'"))
(alert "programs unzipped to C:/XXX-CAD-TOOLS")

(setq *files*  (vla-get-files  (vla-get-preferences (vlax-get-Acad-object))))
(setq paths (vla-get-SupportPath *files*))
(if (wcmatch  paths "*XXX*")
(princ)
(vla-put-SupportPath *files* (strcat "C:\\XXX-CAD-TOOLS" ";" paths))
)
)

  

The definition of insanity is doing the same thing over and over again and expecting different results
0 Likes
Message 9 of 10

Sea-Haven
Mentor
Mentor
Accepted solution

I use menu's a lot so they have the load a lisp for ones only used now and then, I also had 1 master lisp that was loaded via APPLOAD Startup Suite it had numerous other (load lisp) inside it so saving loading like 30 lisps. It also has the Autoload functions this as name implies loads lisp when you type a command. 

 

Help: autoload (AutoLISP) (autodesk.com)

 

 

 

(autoload "DIMFLIP" '("DIMFLIP"))
(autoload "DRAWXFALL" '("DRAWXFALL"))
(autoload "DRAWPIPE" '("DRAWPIPE"))
(autoload "EDITRL" '("EDITRL"))

(load "Multi getvals")
(load "multi Radio buttons")

 

 

 

 

SeaHaven_0-1652317685440.png

 

 

 

Message 10 of 10

EATREVITPOOPCAD
Collaborator
Collaborator

Got it, this is plenty of information for me to play with. Thank you @Sea-Haven & @john.uhden !

The definition of insanity is doing the same thing over and over again and expecting different results
0 Likes