pmadhwal7 Posted June 11, 2020 Posted June 11, 2020 Hi all i am facing one problem that one of my lsp program is starting whenever i start my autocad and problem is i am unable to found out which lsp is that, can anbody help me to disable this on startup Quote
Jonathan Handojo Posted June 11, 2020 Posted June 11, 2020 Several suggestions: 1. Check your startup suite using the APPLOAD command. There might be some lisp files under it. If there are, just remove it. 2. Check your CUI under the Manage Ribbon and then User Interface. There should be a "LISP Files". Maybe there are some. If there are, just right click and unload it 3. If the LISP is your own creation, then you should be able to tell which one is the LISP because you would know which LISP will execute what. Quote
pmadhwal7 Posted June 11, 2020 Author Posted June 11, 2020 29 minutes ago, Jonathan Handojo said: Several suggestions: 1. Check your startup suite using the APPLOAD command. There might be some lisp files under it. If there are, just remove it. 2. Check your CUI under the Manage Ribbon and then User Interface. There should be a "LISP Files". Maybe there are some. If there are, just right click and unload it 3. If the LISP is your own creation, then you should be able to tell which one is the LISP because you would know which LISP will execute what. actually i have uploaded many lsp in my lsp contents and i am unable to found which lsp is creating problem..... Quote
Jonathan Handojo Posted June 11, 2020 Posted June 11, 2020 (edited) Well, I suppose you'll have to manage your codes a bit better... I'm not sure if I know a good approach.... An idea is you can do an iterative approach using LM:directoryfiles to list all lisp files, and then read through every single line... If there's perhaps a line from the code that you remembered, you can list them out. A slow approach if you have hundreds of lisp codes with hundreds of lines each. P.S. If it was me, I'm working with at least 300 codes now, and I never like to load that many LISP files in the startup, I will lose track of what's loaded and what's not, so I created this one LISP routine to load all the routines under that directory and its sub directories. I would: Create a "DO NOT LOAD THIS ONE" folder for any lisp routines that I don't want to load. (This routine below will go into either that folder or nowhere within that same directory or else it will cause an infinite loop.) Put that one in the Startup Suite. That's it ((lambda ( / i) (setq i 1) (mapcar '(lambda (x) (if (vl-catch-all-error-p (vl-catch-all-apply 'load (list x)) ) (progn (alert (strcat "Unable to load \"" x "\" (item number " (itoa i) " in list). Please check if spelling is correct and if file directory exists!")) T ) (progn (setq i (1+ i)) nil) ) ) (vl-remove-if '(lambda (x) (wcmatch (strcase x) "*DO NOT LOAD THIS ONE*") ) (LM:directoryfiles "C:\\Users\\jhandojo\\Desktop\\My LISP Codes" "*.lsp" T) ; Change this directory ) ) T ) ) ;; Directory Files - Lee Mac ;; Retrieves all files of a specified filetype residing in a directory (and subdirectories) ;; dir - [str] Root directory for which to return filenames ;; typ - [str] Optional filetype filter (DOS pattern) ;; sub - [bol] If T, subdirectories of the root directory are included ;; Returns: [lst] List of files matching the filetype criteria, else nil if none are found (defun LM:directoryfiles ( dir typ sub ) (setq dir (vl-string-right-trim "\\" (vl-string-translate "/" "\\" dir))) (append (mapcar '(lambda ( x ) (strcat dir "\\" x)) (vl-directory-files dir typ 1)) (if sub (apply 'append (mapcar '(lambda ( x ) (if (not (wcmatch x "`.,`.`.")) (LM:directoryfiles (strcat dir "\\" x) typ sub) ) ) (vl-directory-files dir nil -1) ) ) ) ) ) Edited June 11, 2020 by Jonathan Handojo Quote
rlx Posted June 11, 2020 Posted June 11, 2020 (edited) If you have all your lisp files in one folder, rename folder and recreate folder again and put the ones you want back until you find the guilty one. And if you can search files by content search *.lsp for MLEADERSTYLE Edited June 11, 2020 by rlx Quote
pmadhwal7 Posted June 11, 2020 Author Posted June 11, 2020 8 hours ago, Jonathan Handojo said: Well, I suppose you'll have to manage your codes a bit better... I'm not sure if I know a good approach.... An idea is you can do an iterative approach using LM:directoryfiles to list all lisp files, and then read through every single line... If there's perhaps a line from the code that you remembered, you can list them out. A slow approach if you have hundreds of lisp codes with hundreds of lines each. P.S. If it was me, I'm working with at least 300 codes now, and I never like to load that many LISP files in the startup, I will lose track of what's loaded and what's not, so I created this one LISP routine to load all the routines under that directory and its sub directories. I would: Create a "DO NOT LOAD THIS ONE" folder for any lisp routines that I don't want to load. (This routine below will go into either that folder or nowhere within that same directory or else it will cause an infinite loop.) Put that one in the Startup Suite. That's it ((lambda ( / i) (setq i 1) (mapcar '(lambda (x) (if (vl-catch-all-error-p (vl-catch-all-apply 'load (list x)) ) (progn (alert (strcat "Unable to load \"" x "\" (item number " (itoa i) " in list). Please check if spelling is correct and if file directory exists!")) T ) (progn (setq i (1+ i)) nil) ) ) (vl-remove-if '(lambda (x) (wcmatch (strcase x) "*DO NOT LOAD THIS ONE*") ) (LM:directoryfiles "C:\\Users\\jhandojo\\Desktop\\My LISP Codes" "*.lsp" T) ; Change this directory ) ) T ) ) ;; Directory Files - Lee Mac ;; Retrieves all files of a specified filetype residing in a directory (and subdirectories) ;; dir - [str] Root directory for which to return filenames ;; typ - [str] Optional filetype filter (DOS pattern) ;; sub - [bol] If T, subdirectories of the root directory are included ;; Returns: [lst] List of files matching the filetype criteria, else nil if none are found (defun LM:directoryfiles ( dir typ sub ) (setq dir (vl-string-right-trim "\\" (vl-string-translate "/" "\\" dir))) (append (mapcar '(lambda ( x ) (strcat dir "\\" x)) (vl-directory-files dir typ 1)) (if sub (apply 'append (mapcar '(lambda ( x ) (if (not (wcmatch x "`.,`.`.")) (LM:directoryfiles (strcat dir "\\" x) typ sub) ) ) (vl-directory-files dir nil -1) ) ) ) ) ) error: no function definition: LM:DIRECTORYFILES Quote
pmadhwal7 Posted June 11, 2020 Author Posted June 11, 2020 7 hours ago, rlx said: If you have all your lisp files in one folder, rename folder and recreate folder again and put the ones you want back until you find the guilty one. And if you can search files by content search *.lsp for MLEADERSTYLE tried but not working... Quote
rlx Posted June 11, 2020 Posted June 11, 2020 maybe you have an mnl file? (menu lisp) or have you a shortcut for MLEADERSTYLE in your acad.pgp , like ML or something and this is called by another routine. I'm sorry to say but maybe there is some truth in what Jonathan said and you have to manage your code a little bit better ... in the end it is like looking for a short circuit , switch off all and switch them back on one by one till the fuse blows and you know the last circuit you switched on is the culprit 1 Quote
ronjonp Posted June 11, 2020 Posted June 11, 2020 2 hours ago, pmadhwal7 said: tried but not working... Do you have your *.lsp index set to "Index Properties and File Contents" ? Quote
rlx Posted June 11, 2020 Posted June 11, 2020 just 4 fun & very old school : (defun GetFolder ( m / f s) (if (and (setq s (vlax-create-object "Shell.Application")) (setq f (vlax-invoke s 'browseforfolder 0 m 0 "")))(setq f (vlax-get-property (vlax-get-property f 'self) 'path)) (setq f nil))(vl-catch-all-apply 'vlax-release-object (list s)) f) (defun findstring ( / a b c d e) (setq a (GetFolder "Select folder for string search")) (setq b (getstring "\nEnter string to search for : ")) (setq c (getstring "\nFile extension (lsp) : ")) (if (eq c "") (setq c "lsp")) (setq d (strcat a "\\result.txt")) (setq e (strcat "findstr /s \"" b "\" " a "\\*." c " > " d)) (command "shell" e) (startapp "notepad" d) (princ) ) 1 Quote
BIGAL Posted June 11, 2020 Posted June 11, 2020 Something I use old DOS command Bottom left in windows command bar CMD CD go to directory required FINDSTR mleader *.lsp it will highlite all programs that have the word mleader. eg CMD CD \BIGAL\LISP FINDSTR Mleader *.lsp Quote
Jonathan Handojo Posted June 12, 2020 Posted June 12, 2020 12 hours ago, pmadhwal7 said: error: no function definition: LM:DIRECTORYFILES My apologies, the function LM:directoryfiles should be placed first before the function: ;; Directory Files - Lee Mac ;; Retrieves all files of a specified filetype residing in a directory (and subdirectories) ;; dir - [str] Root directory for which to return filenames ;; typ - [str] Optional filetype filter (DOS pattern) ;; sub - [bol] If T, subdirectories of the root directory are included ;; Returns: [lst] List of files matching the filetype criteria, else nil if none are found (defun LM:directoryfiles ( dir typ sub ) (setq dir (vl-string-right-trim "\\" (vl-string-translate "/" "\\" dir))) (append (mapcar '(lambda ( x ) (strcat dir "\\" x)) (vl-directory-files dir typ 1)) (if sub (apply 'append (mapcar '(lambda ( x ) (if (not (wcmatch x "`.,`.`.")) (LM:directoryfiles (strcat dir "\\" x) typ sub) ) ) (vl-directory-files dir nil -1) ) ) ) ) ) ((lambda ( / i) (setq i 1) (mapcar '(lambda (x) (if (vl-catch-all-error-p (vl-catch-all-apply 'load (list x)) ) (progn (alert (strcat "Unable to load \"" x "\" (item number " (itoa i) " in list). Please check if spelling is correct and if file directory exists!")) T ) (progn (setq i (1+ i)) nil) ) ) (vl-remove-if '(lambda (x) (wcmatch (strcase x) "*DO NOT LOAD THIS ONE*") ) (LM:directoryfiles "C:\\Users\\jhandojo\\Desktop\\My LISP Codes" "*.lsp" T) ; Change this directory ) ) T ) ) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.