Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Feb 2006
    Posts
    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);

  2. #2
    Join Date
    Apr 2004
    Location
    Vancouver, Canada
    Posts
    1,790
    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

  3. #3
    Join Date
    Feb 2006
    Posts
    346
    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...

  4. #4
    Join Date
    Feb 2006
    Posts
    346
    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);

  5. #5
    Join Date
    Apr 2004
    Location
    Vancouver, Canada
    Posts
    1,790
    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", name.User);
    Dermot

    I am so out of here

  6. #6
    Join Date
    Apr 2004
    Location
    Vancouver, Canada
    Posts
    1,790
    Quote 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

  7. #7
    Join Date
    Feb 2006
    Posts
    346
    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 Images

  8. #8
    Join Date
    Apr 2004
    Location
    Vancouver, Canada
    Posts
    1,790
    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

  9. #9
    Join Date
    Nov 2006
    Posts
    233
    the screenshot shows he's using LanInfo not UserInfo command

  10. #10
    Join Date
    Oct 2007
    Location
    Gensokyo
    Posts
    1,324
    Doesn't matter. The point is that (User.User) is not defined.

  11. #11
    Join Date
    Feb 2006
    Posts
    346
    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);

Similar Threads

  1. Condition syntax for installing files
    By SiriusB in forum Setup Factory 7.0
    Replies: 11
    Last Post: 01-04-2006, 12:54 PM
  2. SQLite syntax question
    By Jim Smiley in forum AutoPlay Media Studio 6.0
    Replies: 9
    Last Post: 11-17-2005, 05:28 PM
  3. Replies: 6
    Last Post: 12-01-2004, 12:45 PM
  4. false syntax error ?
    By cgirolet in forum AutoPlay Media Studio 5.0
    Replies: 2
    Last Post: 11-19-2003, 01:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts