Need a solution to deal with different drive mappings

Discussion in 'AutoCAD' started by Eugene, Jun 24, 2004.

  1. Eugene

    Eugene Guest

    Hello,
    I am writting a progam for our company. Our company consists of 5 different
    offices, each with there own servers and drive mapping. I've setup the
    support folder for my program on each server with the same directory
    structure, but I am forced to use different drive mappings. Currently I have
    a variable called "drive" set as a constant that I use to concatenate the
    directory. But each time I make a modification and copy it out to the other
    offices I have to open each project and change the value of "drive". The
    drive mappings vary from P: ,L :,I: , and F:.

    For a solution, I was thinking of something like;

    Public Drive as string

    Sub FindDrive()
    if file exists DIR("P:/blah/blah/project.dvb") then drive = ("p:\")
    if file exists DIR("F:/blah/blah/project.dvb") then drive = ("f:\")
    etc.
    etc.

    End Sub

    Would that work, and if so is it a good solution?

    Thanks,
    Eugene
     
    Eugene, Jun 24, 2004
    #1
  2. Eugene

    Ed Jobe Guest

    What about creating a system variable (os, not acad) called "AcadDrive" or something similar, setting its value to the local mapping? Then, your code can concatenate the sysvar with the standard portion of your path.

    --
    ----
    Ed
    ----
    Hello,
    I am writting a progam for our company. Our company consists of 5 different
    offices, each with there own servers and drive mapping. I've setup the
    support folder for my program on each server with the same directory
    structure, but I am forced to use different drive mappings. Currently I have
    a variable called "drive" set as a constant that I use to concatenate the
    directory. But each time I make a modification and copy it out to the other
    offices I have to open each project and change the value of "drive". The
    drive mappings vary from P: ,L :,I: , and F:.

    For a solution, I was thinking of something like;

    Public Drive as string

    Sub FindDrive()
    if file exists DIR("P:/blah/blah/project.dvb") then drive = ("p:\")
    if file exists DIR("F:/blah/blah/project.dvb") then drive = ("f:\")
    etc.
    etc.

    End Sub

    Would that work, and if so is it a good solution?

    Thanks,
    Eugene
     
    Ed Jobe, Jun 24, 2004
    #2
  3. You might think about using UNC paths unless you can be certain that the
    drive mapping is consistent and unchangeable.
     
    Mark Johnston, Jun 25, 2004
    #3
  4. UNC won't work unless the servers are the same name, and if they are, the IT
    guys should be shot.

    Ed's is the easiest approach. There might be programmic relief under VB
    Script's network object.

    --
    R. Robert Bell


    You might think about using UNC paths unless you can be certain that the
    drive mapping is consistent and unchangeable.
     
    R. Robert Bell, Jun 25, 2004
    #4
  5. Eugene

    wivory Guest

    Not sure I fully understand your situation, but would any of these help?
    [pre]
    AcadApplication.Path
    Preferences.Files.SupportPath
    AcadApplication.VBE.ActiveVBProject.FileName
    [/pre]
    Regards

    Wayne Ivory
    IT Analyst Programmer
    Wespine Industries Pty Ltd
     
    wivory, Jun 25, 2004
    #5
  6. Eugene

    Jason Wilder Guest

    That's likely going to be your best/simplest approach - always assuming that
    the file path is always the same.

    You could even take it one step further so that you never have keep adding
    lines and just run a loop from A-Z. Ideally making this a sub routine that
    you can just run at the beginning load of your utilities. This way if
    another office opens and decides to use another letter. Just a thought.
     
    Jason Wilder, Jun 25, 2004
    #6
  7. I was thinking in terms of having a list of server names to test against
    instead of mapped drives.
    Users can change their drive mappings but only IT can change server names.
    New machines may not have any mapping but the servers will exist.
    That makes UNC a little more reliable in my opinion.

    Eugene could use the same idea as his FindDrive but make it a FindServer.
    He could test for his known directory on the server.
     
    Mark Johnston, Jun 25, 2004
    #7
  8. Eugene

    Ed Jobe Guest

    You can store UNC paths in a system variable just as easy as a drive letter. Its all text.

    --
    ----
    Ed
    ----
    I was thinking in terms of having a list of server names to test against
    instead of mapped drives.
    Users can change their drive mappings but only IT can change server names.
    New machines may not have any mapping but the servers will exist.
    That makes UNC a little more reliable in my opinion.

    Eugene could use the same idea as his FindDrive but make it a FindServer.
    He could test for his known directory on the server.
     
    Ed Jobe, Jun 25, 2004
    #8
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.