Disable menu based on server name?

Discussion in 'AutoCAD' started by The Real JD, Mar 1, 2005.

  1. The Real JD

    The Real JD Guest

    I'm setting up a menu that can be used in two locations. Most of the menu
    would work the same for each location, but a portion of it is location
    specific. I would like to disable a portion of the menu based on the server
    name...

    so location A would have submenu item MENU-A active but not MENU-B.
    location B would have submenu item MENU-B active but not MENU-A.

    i figure i would need an IF statement in my MNL file, but i'm not sure how
    to search for servername?

    (if ( check for servername))
    (menucmd "Gcadtool2.ID_LOCATION-A=~")
    (princ))
     
    The Real JD, Mar 1, 2005
    #1
  2. The Real JD

    ECCAD Guest

    (setq server (getenv "userdomain"))

    (if (= server "MyLocation")
    ........
    );if

    Bob
     
    ECCAD, Mar 1, 2005
    #2
  3. The Real JD

    Tom Smith Guest

    Look into using ~ to gray out & discable menu items that aren't appropriate. I support two separate groups with different needs. On one pulldown menu where the differences matter, I use !. to check which of two groups it is. Checking or unchecking the group name runs a lisp which sets a variable, and various menu items check this variable via diesel to determine whether or not they're grayed out. There's enough in the help docs to figure this out.
     
    Tom Smith, Mar 1, 2005
    #3
  4. The Real JD

    The Real JD Guest

    Sounds interesting, where is this variable being stored? Does it reload this
    variable after each drawing being loaded?


    appropriate. I support two separate groups with different needs. On one
    pulldown menu where the differences matter, I use !. to check which of two
    groups it is. Checking or unchecking the group name runs a lisp which sets a
    variable, and various menu items check this variable via diesel to determine
    whether or not they're grayed out. There's enough in the help docs to figure
    this out.
     
    The Real JD, Mar 1, 2005
    #4
  5. The Real JD

    The Real JD Guest

    The user domain is the same, i need to reference the name of the server for
    a mapped drive "L".

    But thx for the help, i think it's on the right track
     
    The Real JD, Mar 1, 2005
    #5
  6. The Real JD

    ECCAD Guest

    Well,
    In that case, place a file in L: drive, and do a (findfile..
    on it. If found do A, if not, do B.

    Bob
     
    ECCAD, Mar 1, 2005
    #6
  7. Have you tried (getenv "Logonserver")? It should work provided you have a domain
    controller in each location that is authenticating users. It wouldn't work if
    everyone is using a single server for domain level authentication.

    The other (and most solid) option is to use DosLib's (dos_uncpath) function to
    uniquely identify the drive letter in question. You just have to parse the
    output to get the server name.

    Matt

     
    Matt Stachoni, Mar 1, 2005
    #7
  8. The Real JD

    The Real JD Guest

    I went the doslib route as the networks are pratically identical except for
    servername and plotters that each location has...

    Seems to work! Thx
     
    The Real JD, Mar 2, 2005
    #8
  9. The Real JD

    Tom Smith Guest

    Sounds interesting, where is this variable being stored? Does it reload
    this
    I used useri1 for simplicity, because it's stored in the drawing. So the
    "checkable" pulldown lines look like:

    [$(if,$(=,$(getvar,useri1),1),!.)Company A drawing]^C^C(setdwgtype "A");
    [$(if,$(=,$(getvar,useri1),0),!.)Company B drawing]^C^C(setdwgtype "B");

    The setdwgtype routine sets the value of useri1, so the drawing can be
    changed from one type to the other. The pulldown items that vary by company
    then look like:

    [$(if,$(=,$(getvar,useri1),1),~)&Modification Stamp]^C^C(modstamp);
    [$(if,$(=,$(getvar,useri1),0),~)&Revision Date]^C^C(revdate);

    It would be nice to keep the variable in a different form, for instance as a
    string, but then I'd need to build a method for storing it in each drawing
    and retrieving it. Using useri1 makes this very easy. Of course, if you're
    making the variable dependent on location/server name, you may not care
    about storing it in the drawing, but could simply set it on startup.
     
    Tom Smith, Mar 2, 2005
    #9
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.