Setting File Paths

Setting File Paths

dominique.vdwesthuizen
Contributor Contributor
635 Views
5 Replies
Message 1 of 6

Setting File Paths

dominique.vdwesthuizen
Contributor
Contributor

Hi Guys 

 

I am trying to add to my Trusted file location search Paths as well as Set my Qnew Template. i have manges to add support paths, plot style paths and template paths but cant seem to set these 2? are there any specific reasons why i cant access them. here is the code i use for setting others:

     public void AddPlotStyles(string location)
     {
         Document doc = Application.DocumentManager.MdiActiveDocument;
         Editor ed = doc.Editor;
         var preferences = Application.Preferences as dynamic;
         if (preferences != null)
         {
             try
             {
                 if (preferences.Files.PrinterStyleSheetPath.Equals(location, StringComparison.OrdinalIgnoreCase))
                 {
                     ed.WriteMessage($"\nPlot Style path: {location} Already Exists.");
                 }
                 else
                 {
                     preferences.Files.PrinterStyleSheetPath = location;
                     ed.WriteMessage($"\nPlot Style path: {location} Added.");
                 }
             }
             catch (System.Exception)
             {
                 ed.WriteMessage($"\nPlot Style path: {location} Already Exists.");
             }
         }
     }
0 Likes
636 Views
5 Replies
Replies (5)
Message 2 of 6

SENL1362
Advisor
Advisor

I suppose Trusted Path is not exposed because of obvious reasons.

QNew template: look at you're

var filesPrefs = acadPrefs.Files; 

SENL1362_0-1712318209194.png

 

 

0 Likes
Message 3 of 6

Ed__Jobe
Mentor
Mentor

You can set TrustedPaths with a *.reg file like mine below. Or you can edit it the registry directly through code.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R24.0\ACAD-4107:409\Profiles\<<ACADE>>\Variables]
"TRUSTEDPATHS"="C:\\AcadCustom\\Support_GS"

[HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R24.0\ACAD-4107:409\Profiles\<<VANILLA>>\Variables]
"TRUSTEDPATHS"="C:\\AcadCustom\\Support_GS"

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 4 of 6

SENL1362
Advisor
Advisor

I know but, just like Autodesk, i thought it would be wiser to keep this more or less secret.

0 Likes
Message 5 of 6

Ed__Jobe
Mentor
Mentor

I don't think there's anything secret about it. Any IT tech would know it.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 6 of 6

JamesMaeding
Advisor
Advisor

Not only that, but almost the whole acad security feature is worthless IMO.

The only "dangerous" thing that has ever happened with acad is people including an acad.lsp in the same folder as their drawings. It was never on purpose, but someone devious started sending files with that and people did not know they were bad.

Anyway, that is the only thing to watch for, as the security does not prevent bad things from running, just bad things from loading. The real danger is you purposefully running something bad, and its too late at that point.

The funny thing is it took adesk 5 years to finally add this to the security dialog:

JamesMaeding_0-1712367756035.png

and its the only useful thing, if trying to protect against that almost extinct acad.lsp thing.

Meanwhile, real problems like app ids are left to jump from dwg to dwg like an open border.

 


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes