<local settings> path?

Discussion in 'AutoCAD' started by Scott Davis, Nov 11, 2004.

  1. Scott Davis

    Scott Davis Guest

    I've done a search here, and didn't come up with any hits, so hopefully
    someone can help me out:

    I need to set paths via LiSP, but I need to use the local user settings in
    Documents and Settings. Here's a simplified example:

    (command "*_TOOLPALETTEPATH" "C:/Documents and
    Settings/%localuser%/Application Data/Autodesk/AutoCAD
    2005/R16.1/enu/Support/")

    It's the %local user% part that I can't figure out....what do I plug in
    there to go to the Support directory, regardless of login name?

    TIA,

    Scott
     
    Scott Davis, Nov 11, 2004
    #1
  2. (getvar "loginname")
     
    Alan Henderson @ A'cad Solutions, Nov 11, 2004
    #2
  3. Scott Davis

    Scott Davis Guest

    There has to be an easier way...

    I can get the login name, then I will have to STRCAT C:/Documents and
    Settings/ to the user name, then STRCAT that to Application
    Data/Autodesk/AutoCAD 2005/R16.1/enu/Support/

    I can also GETVAR "localrootprefix" and string that to the /Support
    directory, but it still has to be simpler....

    Thanks for the suggestion, though!
     
    Scott Davis, Nov 11, 2004
    #3
  4. Scott Davis

    Tom Smith Guest

    There has to be an easier way...

    (strcat
    "C:/Documents and Settings/"
    (getvar "loginname")
    "/Application Data/Autodesk/AutoCAD 2005/R16.1/enu/Support/"
    )

    What is the difficulty?
     
    Tom Smith, Nov 12, 2004
    #4
  5. Scott Davis

    Scott Davis Guest

    did something similar....yeah, wasn't that tough:

    (command "*_TOOLPALETTEPATH" (strcat (getvar "ROAMABLEROOTPREFIX")
    "Support\\ToolPalette\\," "F:/CAD/AutoCAD/R2005/Palettes/Main"))

    But what I mean by 'easier' is to have something like Windows:
    %localsettings%\support\Toolpalette

    Then you would not need all the Lisp.

    Thanks!
     
    Scott Davis, Nov 12, 2004
    #5
  6. Scott Davis

    Tom Smith Guest

    AFAIK you can't make the strcat go away beacuse you've got to combine a
    string variable with some other text. But you could "abstract" that line out
    somewhere else, if you think it's uglying up your code. Nothing is gained
    except readability, unless you need to apply this string again somewhere
    else.

    (setq palettelocations (strcat (getvar "ROAMABLEROOTPREFIX")
    "Support\\ToolPalette\\," F:/CAD/AutoCAD/R2005/Palettes/Main")
    ....
    (command "*_TOOLPALETTEPATH" palettelocations)

    Or if you could make a library function that would return a string based on
    the current user.

    (defun d&sfolder ()
    (strcat
    "C:/Documents and Settings/"
    (getvar "loginname")
    "/Application Data/Autodesk/AutoCAD 2005/R16.1/enu/Support/"))

    (command "*_TOOLPALETTEPATH" (d&ssfolder))
     
    Tom Smith, Nov 15, 2004
    #6
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.