Jump to content

Recommended Posts

Posted

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

Annotation 2020-06-11 112605.jpg

Posted

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.

Posted
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.....

Posted (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:

 

  1. 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.)
  2. Put that one in the Startup Suite.
  3. 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 by Jonathan Handojo
Posted (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 by rlx
Posted
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:

 

  1. 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.)
  2. Put that one in the Startup Suite.
  3. 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

Posted
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...

Posted

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 🐛

  • Like 1
Posted
2 hours ago, pmadhwal7 said:

tried but not working...

Do you have your *.lsp index set to "Index Properties and File Contents" ?

image.thumb.png.e9f480a9d8638511912b44988c077c14.png

 

Posted

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)
)

  • Like 1
Posted

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

 

image.thumb.png.6fe7c717d8234eea5da27d0324e66452.png

 

Posted
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
     )
    )

 

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...