Syntax Help/Check

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • abnrange
    No longer a forum member
    • Feb 2006
    • 346

    Syntax Help/Check

    Hello,

    I have a button and on click I would like it to get the user name and display in a dialog. I have this code but something is missing (User.User). Thanks

    Code:
    name = System.GetUserInfo(); 
    Dialog.TimedMessage("Please Wait", "User information is being logged for security purposes. You are logged as"..name..".", 4000, MB_ICONINFORMATION);
  • Dermot
    Indigo Rose Customer
    • Apr 2004
    • 1790

    #2
    System.GetUserInfo() returns a table. The help file is an amazing thing. With a single click you would have had seen that, and how the returned table is indexed.
    Dermot

    I am so out of here :yes

    Comment

    • abnrange
      No longer a forum member
      • Feb 2006
      • 346

      #3
      I did look at the help first. I don't understand how to table User.User

      I was able to get this to work to output to a label. I thought it would be similiar to a dialog.

      name = System.GetUserInfo();
      Label.SetText("UserInfo1", User.User);


      Sorry, Still learning...

      Comment

      • abnrange
        No longer a forum member
        • Feb 2006
        • 346

        #4
        I figured it out Thanks

        Code:
        name = System.GetUserInfo(); 
        name1 = (User.User);
        Dialog.TimedMessage("Please Wait", "User infromation is being logged for security purposes. You are logged as "..name1..".", 4000, MB_ICONINFORMATION);

        Comment

        • Dermot
          Indigo Rose Customer
          • Apr 2004
          • 1790

          #5
          From the help, this is what System.GetUserInfo() returns.

          RegOwner
          string
          The registered owner of the system. If this information cannot be determined, an empty string will be returned.

          RegOrganization
          string
          The organization of the registered owner of the system. If this information cannot be determined, an empty string will be returned.

          IsAdmin
          boolean
          Whether the current user is logged into Windows NT/2000/XP/Vista with Administrator permissions. True will be returned if the user has administrator permissions and false if they do not. On non-NT operating systems, true will always be returned. If this information cannot be determined, false will be returned.

          Note: On Windows Vista, with UAC enabled, administrators are logged in with standard user privileges with the ability to elevate. This will determine if the user has already been elevated to the full access token. See Running On Windows Vista for more information.

          IsVistaAdminLimitedToken
          boolean
          Returns True if the current user on Windows Vista (only) is part of the administrator's group, but only contains a standard user access token (has not been elevated to full administrator privileges). False is returned if UAC (User Account Control) is off, or if the user has already been elevated. For all non-Vista operating systems, the result will be the same as the normal administrator check IsAdmin as mentioned above.
          There is no User field. You can't just makeup fields. If it is not listed in the help file then it does not exist. The table returned by System.GetLANInfo () does have a User field.

          Code:
          name = System.GetLANInfo(); 
          Label.SetText("UserInfo1", [COLOR="Red"]name[/COLOR].User);
          Dermot

          I am so out of here :yes

          Comment

          • Dermot
            Indigo Rose Customer
            • Apr 2004
            • 1790

            #6
            Originally posted by abnrange View Post
            I figured it out Thanks

            Code:
            name = System.GetUserInfo(); 
            name1 = (User.User);
            Dialog.TimedMessage("Please Wait", "User infromation is being logged for security purposes. You are logged as "..name1..".", 4000, MB_ICONINFORMATION);
            That does not work. What is User.User?
            Dermot

            I am so out of here :yes

            Comment

            • abnrange
              No longer a forum member
              • Feb 2006
              • 346

              #7
              Not sure where User.User comes from but it does works. I used it in other projects. I think it came from Mina. See attached image...

              Code:
              -- Get User and LAN info to displaying in a dialog--
              name = System.GetUserInfo(); 
              name1 = (User.User);
              
              LANINFO = System.GetLANInfo();
              LAN = (LANINFO.Host);
              
              name2 = name1..", and computer station "..LAN
              
              Dialog.Message("Status", "Your user information is being logged for security purposes only.\r\n\r\nYou are being logged as user "..name2..".", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
              Attached Files

              Comment

              • Dermot
                Indigo Rose Customer
                • Apr 2004
                • 1790

                #8
                Using that code like you posted does not work. You must have other code elsewhere that defines the table User.

                This is not being used at all in your code.
                Code:
                name = System.GetUserInfo();
                Dermot

                I am so out of here :yes

                Comment

                • Desrat
                  Forum Member
                  • Nov 2006
                  • 240

                  #9
                  the screenshot shows he's using LanInfo not UserInfo command

                  Comment

                  • ShadowUK
                    No longer a forum member
                    • Oct 2007
                    • 1321

                    #10
                    Doesn't matter. The point is that (User.User) is not defined.

                    Comment

                    • abnrange
                      No longer a forum member
                      • Feb 2006
                      • 346

                      #11
                      On Preload there is this code. I did not know that this code directly effected the code on the button - Sorry for the confusion - still learning coding! Thanks for the help.


                      Code:
                      --------write to log file------
                      LANINFO = System.GetLANInfo();
                      TextFile.WriteFromString("AutoPlay\\Docs\\Logs\\HomeLog.dat", LANINFO.Host.."\r\n", true);  
                      
                      name = System.GetUserInfo(); 
                      TextFile.WriteFromString("AutoPlay\\Docs\\Logs\\HomeLog.dat", name.RegOwner.."\r\n", true);
                      
                      IPinfo = System.GetLANInfo();
                      TextFile.WriteFromString("AutoPlay\\Docs\\Logs\\HomeLog.dat", IPinfo.IP.."\r\n", true);
                      
                      User = System.GetLANInfo();
                      TextFile.WriteFromString("AutoPlay\\Docs\\Logs\\HomeLog.dat", User.User.."\r\n", true)
                      
                      result = System.GetDate(DATE_FMT_US);
                      TextFile.WriteFromString("AutoPlay\\Docs\\Logs\\HomeLog.dat", result.."\r\n", true)
                      
                      result1 = System.GetTime(TIME_FMT_MIL);
                      TextFile.WriteFromString("AutoPlay\\Docs\\Logs\\HomeLog.dat", result1.."\r\n", true)
                      
                      --------------------------------------------------------------Display User info --------------------------
                      
                      name1 = System.GetUserInfo(); 
                      Label.SetText("UserInfo1", User.User);
                      
                      LANINFO = System.GetLANInfo();
                      Label.SetText("LanInfo", LANINFO.Host);
                      
                      name1 = System.GetUserInfo(); 
                      Label.SetText("UserInfo2", User.User);

                      Comment

                      Working...
                      X