Author Topic: Support File Search Path  (Read 7409 times)

0 Members and 1 Guest are viewing this topic.

Matersammichman

  • Guest
Support File Search Path
« on: October 25, 2006, 10:52:57 AM »
Looking for code to add a path to my Support File Search Path (without deleting or overwriting existing paths), AND update the info in the Working Support File Search Path. :-P

I tried it yesterday. I accidentally deleted my existing paths...that takes a little while to recover from. Geez! Where the heck is that data saved- In the Registry??? :lol:

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Support File Search Path
« Reply #1 on: October 25, 2006, 11:20:40 AM »
Programmer's responsibility to ensure they provide qualified paths; don't duplicate paths etc.

Code: [Select]
(defun _AddSupportPath ( path / files )
    (vla-put-supportpath
        (setq files
            (vla-get-files
                (vla-get-preferences
                    (vlax-get-acad-object)
                )
            )
        )
        (strcat
            (vla-get-supportpath files) ";"
            path
        )   
    )
)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Matersammichman

  • Guest
Re: Support File Search Path
« Reply #2 on: October 25, 2006, 11:26:12 AM »
MP....Ummm...not sure I understand your comments, and
...oooops!!!
I meant to specifically state, I would really like the code to be in vba.
(not that I'm being picky or anything)

Guest

  • Guest
Re: Support File Search Path
« Reply #3 on: October 25, 2006, 11:32:51 AM »
Quote
I meant to specifically state, I would really like the code to be in vba.
Wasn't there sumpin' just the other day regarding this??  Had to do with changing settings using an EXE??  If I find it, I'll post the link.

Quote
(not that I'm being picky or anything)
You sure are!   :-D

Greg B

  • Seagull
  • Posts: 12417
  • Tell me a Joke!
Re: Support File Search Path
« Reply #4 on: October 25, 2006, 11:36:19 AM »
Quote
(not that I'm being picky or anything)
You sure are!   :-D

No he isn't...he did post it in the VB(A) forum.   :police:

Guest

  • Guest
Re: Support File Search Path
« Reply #5 on: October 25, 2006, 11:42:28 AM »
Here's the link: http://www.theswamp.org/index.php?topic=13146.0

Maybe this'll get you going in the right direction.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Support File Search Path
« Reply #6 on: October 25, 2006, 12:10:24 PM »
MP....Ummm...not sure I understand your comments, and
...oooops!!!
I meant to specifically state, I would really like the code to be in vba.
(not that I'm being picky or anything)

Sorry: My bad, not fully awake. :(
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

deegeecees

  • Guest
Re: Support File Search Path
« Reply #7 on: October 25, 2006, 01:21:41 PM »
I tried it yesterday. I accidentally deleted my existing paths...that takes a little while to recover from. Geez! Where the heck is that data saved- In the Registry??? :lol:

Save a Profile.

Matersammichman

  • Guest
Re: Support File Search Path
« Reply #8 on: October 25, 2006, 01:23:01 PM »
I did.
It's not saved there.

deegeecees

  • Guest
Re: Support File Search Path
« Reply #9 on: October 25, 2006, 01:30:34 PM »
Hmmm... Interesting. What version Acad?

Matersammichman

  • Guest
Re: Support File Search Path
« Reply #10 on: October 25, 2006, 01:32:04 PM »
ADT2005 w/SP2

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Support File Search Path
« Reply #11 on: October 25, 2006, 01:32:26 PM »
Its saved in a profile if you export your profile.  What you need to do is set a varible and append to it.
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Support File Search Path
« Reply #12 on: October 25, 2006, 01:32:47 PM »
here is code to do what you want
Code: [Select]
Public Sub ACADStartup()
    Dim supppath As String
    supppath = UCase(ThisDrawing.Application.Preferences.Files.SupportPath)

    'This will prevent you entering the same entry more than once
    If Not (InStr(1, supppath, "U:\TITLEBLOCKS") > 1) Then
        ThisDrawing.Application.Preferences.Files.SupportPath = supppath & ";" & "U:\TITLEBLOCKS"
    End If

    supppath = UCase(ThisDrawing.Application.Preferences.Files.SupportPath)
    If Not (InStr(1, supppath, "U:\SYMBOLS") > 1) Then
        ThisDrawing.Application.Preferences.Files.SupportPath = supppath & ";" & "U:\SYMBOLS"
    End If

    supppath = UCase(ThisDrawing.Application.Preferences.Files.SupportPath)
    If Not (InStr(1, supppath, "U:\PROJECTLOGS") > 1) Then
        ThisDrawing.Application.Preferences.Files.SupportPath = supppath & ";" & "U:\PROJECTLOGS"
    End If
    Exit Sub
End Sub
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Support File Search Path
« Reply #13 on: October 25, 2006, 01:33:58 PM »
I set supppath = the support path, then append by using
supppath & ";" & "path im adding"
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

deegeecees

  • Guest
Re: Support File Search Path
« Reply #14 on: October 25, 2006, 01:34:18 PM »
Well, *head scratch* I'm lost there, my profiles in 2002 save support paths.

But, I just got this from CmdrDuh:

Code: [Select]
Public Sub ACADStartup()
    Dim supppath As String
    supppath = UCase(ThisDrawing.Application.Preferences.Files.SupportPath)

    'This will prevent you entering the same entry more than once
    If Not (InStr(1, supppath, "U:\TITLEBLOCKS") > 1) Then
        ThisDrawing.Application.Preferences.Files.SupportPath = supppath & ";" & "U:\TITLEBLOCKS"
    End If

    supppath = UCase(ThisDrawing.Application.Preferences.Files.SupportPath)
    If Not (InStr(1, supppath, "U:\SYMBOLS") > 1) Then
        ThisDrawing.Application.Preferences.Files.SupportPath = supppath & ";" & "U:\SYMBOLS"
    End If

    supppath = UCase(ThisDrawing.Application.Preferences.Files.SupportPath)
    If Not (InStr(1, supppath, "U:\PROJECTLOGS") > 1) Then
        ThisDrawing.Application.Preferences.Files.SupportPath = supppath & ";" & "U:\PROJECTLOGS"
    End If
    Exit Sub
End Sub

deegeecees

  • Guest
Re: Support File Search Path
« Reply #15 on: October 25, 2006, 01:34:47 PM »
Oooooops, too slooooowwww....

Matersammichman

  • Guest
Re: Support File Search Path
« Reply #16 on: October 25, 2006, 01:36:18 PM »
Yes, it saves "Support paths", but NOT "WORKING file support paths". They appear to be linked into the Support Paths, but non-editable directly.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Support File Search Path
« Reply #17 on: October 25, 2006, 01:36:44 PM »
nah, I just copy paste faster than you.  BTW, did you get yous working?
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Support File Search Path
« Reply #18 on: October 25, 2006, 01:37:30 PM »
Working paths are what you get after you hit apply and Acad resolves whether you put in valid paths
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Matersammichman

  • Guest
Re: Support File Search Path
« Reply #19 on: October 25, 2006, 01:40:01 PM »
Correct.
Unfortunately, when I deleted\overwrote the "Support" paths, it did not update the "Working" paths.

deegeecees

  • Guest
Re: Support File Search Path
« Reply #20 on: October 25, 2006, 01:42:38 PM »
nah, I just copy paste faster than you.  BTW, did you get yous working?

"Swamped" at the moment. Barely have time to type this. Its on the back burner for now. Just not enough time in the day some times, lunchtime is the only time I have to myself.

Matersammichman

  • Guest
Re: Support File Search Path
« Reply #21 on: October 25, 2006, 02:10:25 PM »
'''Thanks guys, I was using that code to start with yesterday, but there's still a problem. Here is the exact code I am using:

Dim supppath3 As String
    supppath3 =
UCase(ThisDrawing.Application.Preferences.Files.SupportPath)
    If Not (InStr(1, supppath3, "G:\Arc\CAD System\Template") > 1) Then
        ThisDrawing.Application.Preferences.Files.SupportPath =
supppath3 & ";" & "G:\Arc\CAD System\Template"
    End If
    Exit Sub

'''what happens is that it will put it in the Support path once as UCase, and once as LCase. Why???

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Support File Search Path
« Reply #22 on: October 25, 2006, 02:27:01 PM »
Duplications due to case and slash characters is why I have entries like this in my lisp library --

Code: [Select]
(defun _Replace ( oldText newText text / i )
    (if (/= oldText newText)
        (while (setq i (vl-string-search oldText text))
            (setq text
                (vl-string-subst
                    newText
                    oldText
                    text
                    i
                )
            )
        )
    )
    text
)

And then this --

Code: [Select]
(defun _AddStr ( str1 str2 delim )

    ;;  add str2 to the end of str1 if str2 doesn't exist in str1 (case
    ;;  and slash insensitive) -- put delim between str1 and str2

    (   (lambda ( string pattern )
            (if
                (null
                    (or
                        (wcmatch string pattern)
                        (wcmatch string (strcat pattern delim "*"))
                        (wcmatch string (strcat "*" delim pattern delim "*"))
                        (wcmatch string (strcat "*" delim pattern))
                    )
                )
                (strcat str1 delim str2)
                str1
            )   
        )
        (strcase (_Replace "/" "\\" str2))       
        (strcase (_Replace "/" "\\" str1))       
    )   
)

Feel free to convert to equivalent VB code. I'd do it but (1) headache (2) too sleepy, even though it's admittedly a trivial task.

:)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Support File Search Path
« Reply #23 on: October 25, 2006, 02:33:20 PM »
It is put in in lower case the first time, then the second time through, It converts it to upper case, and when the check is run to see if its there, it doesn't find it (I know its there, but upper and lower are treated as different cases)

The way to fix your problem is when you add the path, use all upper case
Code: [Select]
  supppath3 =
UCase(ThisDrawing.Application.Preferences.Files.SupportPath)
    If Not (InStr(1, supppath3, "G:\Arc\CAD System\Template") > 1) Then
        ThisDrawing.Application.Preferences.Files.SupportPath =
supppath3 & ";" & "G:\ARC\CAD SYSTEM\TEMPLATE"  ' ADDED THIS LINE
« Last Edit: October 25, 2006, 02:35:34 PM by CmdrDuh »
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Matersammichman

  • Guest
Re: Support File Search Path
« Reply #24 on: October 25, 2006, 02:33:51 PM »
Actually, I really appreciate all the help.
I just resolved my own dilemma. WooHoo!!!

Here's the deal:
For whatever reason, vba writes into the Support paths (and all the others as well) all in CAPS. If your code is written in anything else (mixed, or lower case), you will get two entries in your paths: One in whatever case your code is written in, and one in all caps.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Support File Search Path
« Reply #25 on: October 25, 2006, 02:34:55 PM »
See my above post
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Matersammichman

  • Guest
Re: Support File Search Path
« Reply #26 on: October 25, 2006, 02:36:10 PM »
I think we were typing at the same time.
Thanks again swampers!