Set Support Paths with LISP and Supersede Existing Path

Set Support Paths with LISP and Supersede Existing Path

k_jenkins
Participant Participant
411 Views
2 Replies
Message 1 of 3

Set Support Paths with LISP and Supersede Existing Path

k_jenkins
Participant
Participant

We've put together a LISP to apply new customisation to existing user CAD profiles. Below is an extract.

The script works great, except for one part...

 

The goal is to set the new default path for Acaddoc.lsp within the Support paths.
The Script does the job and i've even written the values to the registry for good measure.

; Set ACAD Variables
(vla-put-supportpath
  #Files
  (strcat ";"
		  "C:\\_STAU_C\\ACAD\\Setup\\LISP;"
		  "C:\\_STAU_C\\ACAD\\Setup\\Fonts;"
		  ";"
		  (vla-get-supportpath #Files)
  ) ;_ strcat
)
; Set Registry for good measure ?
	(vl-registry-read (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\Profiles\\" (getvar 'cprofile) "\\General") "ACAD")
	(setq supportpath1 (vl-registry-read (strcat "HKEY_CURRENT_USER\\" (vlax-product-key)
	"\\Profiles\\" (getvar 'cprofile) "\\General") "ACAD"))
	(cond ((wcmatch supportpath1 "~*C:\\_STAU_C\\ACAD\\Setup\\LISP*")
				(vl-registry-write (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\Profiles\\" (getvar 'cprofile) "\\General") 
						"ACAD" (strcat "C:\\_STAU_C\\ACAD\\Setup\\LISP;" supportpath1)
	)))

 

The issue i'm having is some users will already have a support path with ACADDOC.lsp within their profile. So the approach was to add new paths to the top of the Support path list with vla-put-supportpath.
However, regardless of where the new path is placed in the list (top/bottom/middle), Autocad will not read the new directory unless you manually open the options menu and physically change something and click Apply.

After doing so, all the settings are properly applied.

 

No amount of restarts fixes this.

How can I force the options to refresh or apply from AutoLSP without manually doing so.

0 Likes
Accepted solutions (1)
412 Views
2 Replies
Replies (2)
Message 2 of 3

kpblc2000
Advisor
Advisor
Accepted solution

use (setenv "ACAD" ...) instead of vla-put-supportpaths and registry write-read. It's more effective

Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям! | Do you find the posts helpful? "LIKE" these posts!
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.


Алексей Кулик aka kpblc | Aleksei Kulik aka kpblc Facebook | LinkedIn
autolisp.ru
Техническая поддержка программистов Autodesk в СНГ
Библиотека пользовательских lisp-функций | Custom Lisp-function library

0 Likes
Message 3 of 3

k_jenkins
Participant
Participant

My goodness, such a simple answer and so effective, thanks

0 Likes