Install lisp for installing multiple files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Having the need to provide multiple lisp, dcl, icons and menu files in a simple install method the following is a simple way around it. It uses 2 files "install.lsp" and a "ZIP" file the zip contains all the required files, in the back door of windows is a way to unzip a file to a directory. This is a windows command but it can be called from a lisp.
So say you send a email with the 2 files the end user just saves them some where, "Downloads etc" a simple drag and drop or a appload of the install.lsp and the install is ran including loading the menu nad setting support paths.
So this install makes a directory on c: drive, using getfiled you select the zip, the rest is auto completed. The zip is xxxx-AlanH-Dec-2021.zip in this example. The menu is a cuix of a POP menu other menu types could be added.
(defun xxxxinstall ( / *files* filename newpath oldtrust paths menu_path menu_name Group_name)
(vl-load-com)
(vl-mkdir "c:\\xxxx-CAD-TOOLS")
(setq filename (getfiled "Select the File \"xxxx-AlanH-Dec-2021\"" "" "ZIP" 16))
; unzip
(startapp (strcat "powershell -command Expand-Archive -Path '" filename "' -DestinationPath 'C:/xxxx-CAD-TOOLS'"))
(alert "programs unzipped to C:/xxxx-CAD-TOOLS")
(setq *files* (vla-get-files (vla-get-preferences (vlax-get-Acad-object))))
(setq paths (vla-get-SupportPath *files*))
(if (wcmatch paths "*xxxx*")
(princ)
(vla-put-SupportPath *files* (strcat "C:\\xxxx-CAD-TOOLS" ";" paths))
)
(if (> (vl-string-search "BricsCAD" (getvar 'acadver)) 0)
(princ "Bricscad")
(progn
(setq oldtrust (getvar 'trustedpaths))
(setvar 'trustedpaths (strcat oldtrust ";" "c:\\xxxx-CAD-TOOLS"))
)
)
(alert "\nSupport paths added")
(setq Menu_Path "C:\\xxxx-CAD-TOOLS\\"); Path to Menu file
(setq Menu_Name "xxxx-CAD-TOOLS"); pop menu to load
(setq Group_Name "xxxxMENU"); groupname assigned in .mnu or .mns file
(if (menugroup menu_Name)
(command "_MENUUNLOAD" menu_Name)
)
(setq cnt (vla-get-count(vla-get-menuGroups (vlax-get-acad-object))))
(command "MENULOAD" (strcat Menu_Path Menu_Name))
(menucmd (strcat "P" (rtos cnt 2 0) "=+" menu_Name ".POP1"))
(alert "\n Menu loaded \n \n xxxx AlanH programs now installed")
)
(xxxxinstall)