2.) Open the file remembered in step 1 and read each line resulting in a count of how many files are listed in the file known as "customlisp.dat"
(setq x (open fil "r") ct 0)
(while (read-line x)
(setq ct (1+ ct))
3.) Re-open the "customlisp.dat" file, and use the count saved in the variable "ct" to verify that we haven't reached the end of the list, begin loading each file listed by reading the filename from "customlisp.dat" and verifying that the file exists and can be found on the network. This loop uses the visual lisp sub routine: "vl-file-systime
". If the file cannot be found, there will be information written to the command line telling the user who to contact to correct this problem (this is stored in the variable "ccinfo"). When the file is found, it will be loaded. Note: each file has its own prompt to let the user know that the file has been correctly loaded.
That is all that is required to modularize and automatically load as many custom lisp routines as you desire.
(setq y (open fil "r") rt 0)
(setq ccinfo "... Contact CAD Coordinator #4855")
(setq filenom (read-line y))
(if (/= (vl-file-systime filenom) nil)
(load (findfile filenom)
(strcat "\n" filenom " not found " ccinfo)
(prompt (strcat "\n" filenom " not found " ccinfo))
(setq rt (1+ rt))
I hope you put this to use in your own environments. If you want a method with a little more functionality and features, learn how to fully modularize this loading routine using the Registry by reading my "Controlling Customization" series which started in the November 2004 issue of AUGI's HotNews newsletter. The latest article (the third in the series) should be released any day now.