Lisp to change Support paths and Trusted Locations

Lisp to change Support paths and Trusted Locations

DC-MWA
Collaborator Collaborator
536 Views
5 Replies
Message 1 of 6

Lisp to change Support paths and Trusted Locations

DC-MWA
Collaborator
Collaborator

I have a setup lisp that sets the support paths and trusted locations. If certain files are located on the c: drive it uses c: drive paths, but it leaves all the f: drive paths.

Sets the path to:

"C:\CAD-support\bin\lsp"

 

But leaves the original:

"F:\CAD-support\bin\lsp"

 

Is there a way I can change all the drive letters in the paths for support paths and trusted locations from c: to f: and visa versa?

0 Likes
Accepted solutions (2)
537 Views
5 Replies
Replies (5)
Message 2 of 6

paullimapa
Mentor
Mentor
Accepted solution

what if you retrieve say the TrustedPaths variable and store that as tp and do a search & replace for c: with f: using this function:

 (defun aec_replace (new old string / pos)
  (while (setq pos (vl-string-search old string pos))
   (setq string (vl-string-subst new old string pos)
         pos    (+ pos (strlen new))
   ) ; setq
  ) ; while
  string
 ) ; defun
(setq tp (getvar "trustedpaths")) ; getvar current value
(setq tp (aec_replace "f:" "c:" tp)) ; search+replace lowercase drive letter
(setq tp (aec_replace "F:" "C:" tp)) ; search+replace uppercase drive letter
(setvar "trustedpaths" tp) ; setvar the new value

Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 6

ronjonp
Mentor
Mentor
Accepted solution

@DC-MWA 

You should share the code you're using to set the paths. If you swap the drive letter then you'll have duplicate paths defined. Lee's Wildcard Remove Support File Search Paths should do the trick: 

(LM:wcsfsp- "F:\\*")

ronjonp_0-1721864779095.png

 

 

0 Likes
Message 4 of 6

DC-MWA
Collaborator
Collaborator

This worked perfectly for the trusted paths.

Thank you!

0 Likes
Message 5 of 6

DC-MWA
Collaborator
Collaborator

This worked perfect for support paths.

Thank you.

0 Likes
Message 6 of 6

paullimapa
Mentor
Mentor

glad to have helped...cheers!!!


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes