Author Topic: Adding "Trusted Locations" by accessing the AcadObject  (Read 3490 times)

0 Members and 1 Guest are viewing this topic.

psuchewinner

  • Guest
Adding "Trusted Locations" by accessing the AcadObject
« on: April 03, 2014, 11:11:43 AM »
im not sure if this question has been asked (i did search for it) but i am wondering if the "Trusted Locations" can be accessed the same way the "support path" would be.

(vl-load-com);enable VLisp functions
  (setq AcadObject (vlax-get-acad-object));store a reference to the Application Object
  (setq PrefsObject (vlax-get-property AcadObject 'Preferences));store a reference to Preferences (Preferences object)
  (setq TabNameObjectoptions (vlax-get-property PrefsObject 'Files));Store a reference to the Files (Files Object)

;----------------Support Path manipulation------------------
  (setq ThePath (vlax-get-property TabNameObject 'SupportPath));get the existing supprt path
  (setq TrustedSites (vlax-get-property TabNameObject 'TrustedLocations));get the existing Trusted Sites
  (setq ThePath (strcat ThePath ";" "\\nprdd08\\acm03\\user\\andy\\blocks;\\nprdd08\\acm03\\user\\andy\\file;\\nprdd08\\acm03\\user\\andy\\menu;c:\\documents and settings\\acm03\\acad stuff\\menu stuff;c:\\documents and settings\\acm03\\acad stuff\\blocks"))
;---------------Update the path-----------------------------
  (vlax-put-property TabNameObject 'SupportPath ThePath)

I have looked for the "Trusted Locations" in the AcadObject but i dont readily see it...... :x

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Adding "Trusted Locations" by accessing the AcadObject
« Reply #1 on: April 03, 2014, 11:34:40 AM »
If you don't want to mess with it just set SECURELOAD to 0.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

psuchewinner

  • Guest
Re: Adding "Trusted Locations" by accessing the AcadObject
« Reply #2 on: April 03, 2014, 01:10:02 PM »
aside from that.....

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Adding "Trusted Locations" by accessing the AcadObject
« Reply #3 on: April 03, 2014, 01:33:08 PM »
Try something like this:

(setvar 'trustedpaths (strcat (getvar 'trustedpaths) ";" (getenv "userprofile")))

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

BlackBox

  • King Gator
  • Posts: 3770
Re: Adding "Trusted Locations" by accessing the AcadObject
« Reply #4 on: April 03, 2014, 01:51:34 PM »
im not sure if this question has been asked (i did search for it) but i am wondering if the "Trusted Locations" can be accessed the same way the "support path" would be.
...

I have looked for the "Trusted Locations" in the AcadObject but i dont readily see it...... :x

Your findings are correct; TrustedPaths has not been exposed to the PreferencesFiles Object in LISP.

If for some reason (setvar 'trustedpaths ...) is insufficient, consider using Visual LISP's Registry functions on the following key:

Code - Auto/Visual Lisp: [Select]
  1. HKEY_CURRENT_USER\<YourProduct>\Profiles\<YourProfile>\Variables\TRUSTEDPATHS
  2.  
"How we think determines what we do, and what we do determines what we get."

ChrisCarlson

  • Guest
Re: Adding "Trusted Locations" by accessing the AcadObject
« Reply #5 on: April 03, 2014, 02:32:05 PM »
Why not just add it from the options prompt? As of 2014 (maybe earlier) the directories are recursive from the dir selected.

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Adding "Trusted Locations" by accessing the AcadObject
« Reply #6 on: April 03, 2014, 02:50:54 PM »
im not sure if this question has been asked (i did search for it) but i am wondering if the "Trusted Locations" can be accessed the same way the "support path" would be.
...

I have looked for the "Trusted Locations" in the AcadObject but i dont readily see it...... :x

...

If for some reason (setvar 'trustedpaths ...) is insufficient, consider using Visual LISP's Registry functions on the following key:

Code - Auto/Visual Lisp: [Select]
  1. HKEY_CURRENT_USER\<YourProduct>\Profiles\<YourProfile>\Variables\TRUSTEDPATHS
  2.  


Worked fine here?
(setvar 'trustedpaths (strcat (getvar 'trustedpaths) ";" (getenv "userprofile")))

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

BlackBox

  • King Gator
  • Posts: 3770
Re: Adding "Trusted Locations" by accessing the AcadObject
« Reply #7 on: April 03, 2014, 03:33:54 PM »
im not sure if this question has been asked (i did search for it) but i am wondering if the "Trusted Locations" can be accessed the same way the "support path" would be.
...

I have looked for the "Trusted Locations" in the AcadObject but i dont readily see it...... :x

...

If for some reason (setvar 'trustedpaths ...) is insufficient, consider using Visual LISP's Registry functions on the following key:

Code - Auto/Visual Lisp: [Select]
  1. HKEY_CURRENT_USER\<YourProduct>\Profiles\<YourProfile>\Variables\TRUSTEDPATHS
  2.  


Worked fine here?
(setvar 'trustedpaths (strcat (getvar 'trustedpaths) ";" (getenv "userprofile")))

... "insufficient" as in user preference; not that it doesn't work.  :-)

I personally use the system variable... Simply tried to offer the only other programmatic alternative I could think of, in lieu of the would-be TrustedPaths Property of the PreferencesFiles Object.
"How we think determines what we do, and what we do determines what we get."

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Adding "Trusted Locations" by accessing the AcadObject
« Reply #8 on: April 03, 2014, 03:38:31 PM »
Gotcha  :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

psuchewinner

  • Guest
Re: Adding "Trusted Locations" by accessing the AcadObject
« Reply #9 on: April 03, 2014, 03:48:02 PM »
Thanks guys, I have some code that I run when we get a new version of ACAD around here to set all that stuff back to the way i like it.  I set the support path through the preferencefiles object and liked how it looked in code so i figured i would try to stay consistant.  i have no problem setting SECURELOAD to 0.  i was just curious.  i dont get much time with ACAD these days so its nice to at least work on my coding skills everyonce in a while.

BlackBox

  • King Gator
  • Posts: 3770
Re: Adding "Trusted Locations" by accessing the AcadObject
« Reply #10 on: April 03, 2014, 04:08:52 PM »
... i have no problem setting SECURELOAD to 0....

FWIW - You may, or may not find some useful information following the 'security' link in my signature... err... here.

Cheers
"How we think determines what we do, and what we do determines what we get."