How do I export "userinfo" to a text file?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • jhiltabidel
    Indigo Rose Customer
    • Dec 2007
    • 26

    How do I export "userinfo" to a text file?

    If I use these actions:

    result = System.GetDate(DATE_FMT_US);
    result = System.GetLANInfo();
    result = System.GetMemoryInfo();
    result = System.GetOSName();
    result = System.GetTime(TIME_FMT_MIL);
    result = System.GetUserInfo();


    How can I then export these things to a .log file?

    Thank you,

    Joe
  • columbo
    Forum Member
    • May 2007
    • 9

    #2
    Hello,

    perhaps it's what you need ..

    example :
    Code:
    --///CREATE LOG FOLDER IF DON'T EXIST///
    Folder.Create("C:\\log");
    
    --///CREATE LOG.TXT IN C:\LOG WITH RESULT///
    result = System.GetDate(DATE_FMT_US);
    TextFile.WriteFromString("c:\\log\\log.txt" , result .. "\r\n", false);
    
    result = System.GetOSName();
    TextFile.WriteFromString("c:\\log\\log.txt" , result .. "\r\n", true);
    
    result = System.GetTime(TIME_FMT_MIL);
    TextFile.WriteFromString("c:\\log\\log.txt" , result .. "\r\n", true);

    Comment

    • TJ_Tigger
      Indigo Rose Customer
      • Sep 2002
      • 3159

      #3
      you can collect all the information into multiple variables and then write those variables to a text file.

      result1 = System.GetDate(DATE_FMT_US);
      result2 = System.GetLANInfo();
      result3 = System.GetMemoryInfo();
      result4 = System.GetOSName();
      result5 = System.GetTime(TIME_FMT_MIL);
      result6 = System.GetUserInfo();

      TextFile.WriteFromString("filename", result1.."\r\n"..result2.."\r\n". . .

      or you can combine the above into a single varible

      result = System.GetDate(DATE_FMT_US);
      result = result .. "\r\n" .. System.GetLANInfo();
      result = result .. "\r\n" .. System.GetMemoryInfo();
      result = result .. "\r\n" .. System.GetOSName();
      result = result .. "\r\n" .. System.GetTime(TIME_FMT_MIL);
      result = result .. "\r\n" .. System.GetUserInfo();

      TextFile.WriteFromString("filename, result, false);

      HTH
      Tigg
      TJ-Tigger
      "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
      "Draco dormiens nunquam titillandus."
      Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

      Comment

      • columbo
        Forum Member
        • May 2007
        • 9

        #4
        HOHO good code ! i like these .. it's better than mine.. thanks

        Code:
        result = System.GetDate(DATE_FMT_US);
        result = result .. "\r\n" .. System.GetLANInfo();
        result = result .. "\r\n" .. System.GetMemoryInfo();
        result = result .. "\r\n" .. System.GetOSName();
        result = result .. "\r\n" .. System.GetTime(TIME_FMT_MIL);
        result = result .. "\r\n" .. System.GetUserInfo();
        TextFile.WriteFromString("filename, result, false);

        Comment

        • jhiltabidel
          Indigo Rose Customer
          • Dec 2007
          • 26

          #5
          Thank you both! What does the \r \n mean?

          Would my finished code look like this? I'm a noob.

          result1 = System.GetDate(DATE_FMT_US);
          result2 = System.GetLANInfo();
          result3 = System.GetMemoryInfo();
          result4 = System.GetOSName();
          result5 = System.GetTime(TIME_FMT_MIL);
          result6 = System.GetUserInfo();

          TextFile.WriteFromString("C:\\test.log",result1.." \r\n"..result2.."\r\n"..result3.."\r\n"..result4.. "\r\n"..result5.."\r\n"..result6)

          Comment

          • azmanar
            Indigo Rose Customer
            • Oct 2004
            • 1020

            #6
            Hi,

            I would write like below so that I can arrange and reuse variables as well as recall the logic when I reopen the project a few months later.

            Code:
            sPCDate = System.GetDate(DATE_FMT_US);
            sPCLanInfo = System.GetLANInfo();
            sPCMemInfo = System.GetMemoryInfo();
            sPCOS = System.GetOSName();
            sPCTime = System.GetTime(TIME_FMT_MIL);
            sPCUser = System.GetUserInfo();
            
            TextFile.WriteFromString("C:\\test.log",sPCDate.." \r\n"..sPCLanInfo.."\r\n"..sPCMemInfo.."\r\n"..sPCOS.. "\r\n"..sPCTime.."\r\n"..sPCUser)
            \r\n are escaped characters. This is to write the next variable value on a newline in the text file. There are several other escaped characters.

            Instead of using "\r\n", you can also write all values on the same line by separating them using the pipe symbol " | " or comma " , " or any other characters. Very useful if you plan to reuse the values in Excel or SQL softwares.
            Newbie Examples
            ------> AMS 7.5 : amstudio.azman.info
            ----> AMS 6 & 5: www.azman.info/ams/
            ----> FB: facebook.com/GuideToWealth

            ----> Content Development Blog: www.AZMAN.asia

            Comment

            • jhiltabidel
              Indigo Rose Customer
              • Dec 2007
              • 26

              #7
              Thanks Azmanar for the update! I get this message when testing the code:

              Line 8: attempt to concatenate global 'sPCUser' (a table value)

              Is the userinfo table and the others are string -- then how do I output them both?

              Thanks,

              Joe

              Comment

              • longedge
                Indigo Rose Customer
                • Aug 2003
                • 2498

                #8
                Try -
                Code:
                TextFile.WriteFromString("C:\\test.log",sPCDate.." \r\n"..sPCLanInfo.User.."\r\n"..sPCMemInfo.TotalRAM.."\r\n"..sPCOS.. "\r\n"..sPCTime.."\r\n"..sPCUser.RegOwner)
                System.GetLANInfo, System.GetMemoryInfo and System.GetUserInfo all return tables and you need to specify which element of the table you require.

                Comment

                • jhiltabidel
                  Indigo Rose Customer
                  • Dec 2007
                  • 26

                  #9
                  That works great! I modified it slightly so that it would append the file with a space between instances. I thought the GetLanInfo would collect IP address, no?

                  Is there someway to collect the IP address,

                  Basically I'm trying to collect as much of the same information that shows up under windows cmd by typing systeminfo (I just don't want all that hotfix information). If I can't collect it all, then as much as possible would be great.... this is what mine shows (with all hotfix information edited out):

                  Host Name: JHILTABIDEL
                  OS Name: Microsoft Windows XP Professional
                  OS Version: 5.1.2600 Service Pack 2 Build 2600
                  OS Manufacturer: Microsoft Corporation
                  OS Configuration: Member Workstation
                  OS Build Type: Uniprocessor Free
                  Registered Owner: Lab User
                  Registered Organization:
                  Product ID: 76487-640-8608634-23484
                  Original Install Date: 11/8/2007, 12:24:19 PM
                  System Up Time: 0 Days, 6 Hours, 24 Minutes, 41 Seconds
                  System Manufacturer: Dell Inc.
                  System Model: Latitude D610
                  System type: X86-based PC
                  Processor(s): 1 Processor(s) Installed.
                  [01]: x86 Family 6 Model 13 Stepping 8 GenuineIntel ~
                  1595 Mhz
                  BIOS Version: DELL - 27d50a02
                  Windows Directory: C:\WINDOWS
                  System Directory: C:\WINDOWS\system32
                  Boot Device: \Device\HarddiskVolume2
                  System Locale: en-us;English (United States)
                  Input Locale: en-us;English (United States)
                  Time Zone: (GMT-05:00) Eastern Time (US & Canada)
                  Total Physical Memory: 503 MB
                  Available Physical Memory: 83 MB
                  Virtual Memory: Max Size: 2,048 MB
                  Virtual Memory: Available: 2,008 MB
                  Virtual Memory: In Use: 40 MB
                  Page File Location(s): C:\pagefile.sys
                  Domain: fu.campus
                  Logon Server: \\NIGEL

                  NetWork Card(s): 3 NIC(s) Installed.
                  [01]: Intel(R) PRO/Wireless 2200BG Network Connection

                  Connection Name: Wireless Network Connection
                  [02]: Broadcom NetXtreme 57xx Gigabit Controller
                  Connection Name: Local Area Connection
                  DHCP Enabled: Yes
                  DHCP Server: 156.143.130.3
                  IP address(es)
                  [01]: 156.143.132.103
                  [03]: Bluetooth Personal Area Network from TOSHIBA
                  Connection Name: Local Area Connection 2
                  Status: Media disconnected


                  Am I one of those users asking too much? Thanks again for everyones help!

                  Comment

                  Working...
                  X