Error Message in fGet ComputerInfo

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • asusnet
    Forum Member
    • Aug 2007
    • 2

    Error Message in fGet ComputerInfo

    How can fix these error??
    In 7.5 version do'nt have any problem, only in 8.0 version.



    Code onShow:

    Page.StartTimer(1000);

    -- Function to get the workstation system information
    function fGetComputerInfo()
    -- Get the processor name and speed
    sProcessorName = Registry.GetValue(HKEY_LOCAL_MACHINE, "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\ 0", "ProcessorNameString", false);
    if sProcessorName == "" then
    sProcessorName = Registry.GetValue(HKEY_LOCAL_MACHINE, "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\ 0", "VendorIdentifier", false);
    if sProcessorName == "" then
    sProcessorName = Registry.GetValue(HKEY_LOCAL_MACHINE, "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\ 0", "Identifier", false);
    end
    end
    sProcessorSpeed = Registry.GetValue(HKEY_LOCAL_MACHINE, "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\ 0", "~MHz", false);
    nProcessorSpeed = String.ToNumber(sProcessorSpeed);
    if nProcessorSpeed >= 1000 then
    nProcessorSpeedGHz3 = nProcessorSpeed / 1000;
    nProcessorSpeedGHz = Math.Round(nProcessorSpeedGHz3, 2);
    sProcessorSpeedPretty = nProcessorSpeedGHz.. "GHz";
    elseif nProcessorSpeed < 1000 then
    sProcessorSpeedPretty = nProcessorSpeed.. "MHz";
    end
    sProcessorNameTrimmed = String.TrimLeft(sProcessorName, " ");
    Paragraph.SetText("N_LabelCPUText", sProcessorNameTrimmed.. " @ ~"..sProcessorSpeedPretty);
    -- Get the amount of available memory to Windows
    tSystemRAMFake = System.GetMemoryInfo();
    nSystemRAM = Math.Floor((tSystemRAMFake.TotalRAM + 3) / 4) * 4;
    if nSystemRAM >= 1024 then
    nSystemRAMGB3 = nSystemRAM / 1024;
    nSystemRAMGB = Math.Round(nSystemRAMGB3, 1);
    sSystemRAM = nSystemRAMGB.." GB";
    elseif nSystemRAM < 1024 then
    sSystemRAM = nSystemRAM.." MB";
    end
    Label.SetText("N_LabelMemoryText", sSystemRAM.." (~"..tSystemRAMFake.MemoryLoad.."% used)");
    -- Get a list of all detected drives
    ListBox.DeleteItem("N_ListBoxDrives", LB_ALLITEMS);
    tDrives = Drive.Enumerate();
    nDriveCount = Table.Count(tDrives);
    nDriveCountStart = 1;
    for index in tDrives do
    nDriveType = Drive.GetType(tDrives[index]);
    if nDriveType == 2 then
    sDriveType = "Removable Disk";
    ListBox.AddItem("N_ListBoxDrives", tDrives[index].." ("..sDriveType..")", "");
    elseif nDriveType == 3 then
    sDriveType = "Fixed Disk";
    tDriveInformation = Drive.GetInformation(tDrives[index]);
    if tDriveInformation ~= nil then
    sDriveFileSystem = tDriveInformation.FileSystem;
    sDriveDisplayName = tDriveInformation.DisplayName;
    nDriveUsedSpaceMB = Drive.GetUsedSpace(tDrives[index]);
    nDriveUsedSpaceB = (nDriveUsedSpaceMB * 1024) * 1024;
    nDriveTotalSpaceMB = Drive.GetSize(tDrives[index]);
    nDriveTotalSpaceB = (nDriveTotalSpaceMB * 1024) * 1024;
    sDriveTotalSpace = String.GetFormattedSize(nDriveTotalSpaceB, FMTSIZE_AUTOMATIC, true);
    nDriveFreePercent = (nDriveUsedSpaceB / nDriveTotalSpaceB) * 100;
    ListBox.AddItem("N_ListBoxDrives", tDrives[index].." ("..sDriveDisplayName..", "..sDriveType..", "..sDriveFileSystem..", "..sDriveTotalSpace..", "..Math.Round(nDriveFreePercent, 0).."% used)", "");
    end
    elseif nDriveType == 4 then
    sDriveType = "Network Drive";
    tDriveInformation = Drive.GetInformation(tDrives[index]);
    if tDriveInformation ~= nil then
    sDriveFileSystem = tDriveInformation.FileSystem;
    sDriveDisplayName = tDriveInformation.DisplayName;
    nDriveUsedSpaceMB = Drive.GetUsedSpace(tDrives[index]);
    nDriveUsedSpaceB = (nDriveUsedSpaceMB * 1024) * 1024;
    nDriveTotalSpaceMB = Drive.GetSize(tDrives[index]);
    nDriveTotalSpaceB = (nDriveTotalSpaceMB * 1024) * 1024;
    sDriveTotalSpace = String.GetFormattedSize(nDriveTotalSpaceB, FMTSIZE_AUTOMATIC, true);
    nDriveFreePercent = (nDriveUsedSpaceB / nDriveTotalSpaceB) * 100;
    ListBox.AddItem("N_ListBoxDrives", tDrives[index].." ("..sDriveDisplayName..", "..sDriveType..", "..sDriveFileSystem..", "..sDriveTotalSpace..", "..Math.Round(nDriveFreePercent, 0).."% used)", "");
    else
    ListBox.AddItem("N_ListBoxDrives", tDrives[index].." (Unknown or disconnected)", "");
    end
    elseif nDriveType == 5 then
    sDriveType = "CD/DVD Drive";
    ListBox.AddItem("N_ListBoxDrives", tDrives[index].." ("..sDriveType..")", "");
    else
    sDriveType = "Unknown"
    ListBox.AddItem("N_ListBoxDrives", tDrives[index].." ("..sDriveType..")", "");
    end
    end
    -- Get a list of all installed playback WDM audio devices
    ListBox.DeleteItem("N_ListBoxAudioDevices", LB_ALLITEMS);
    sAudioOutDevices = DLL.CallFunction("AutoPlay\\Docs\\WaveInOutDev.dll ", "GetWaveOutDevs", "", DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)
    nCountOut = 1;
    if sAudioOutDevices ~= "" then
    nSemiColons = String.Find(sAudioOutDevices, ";;", 1, false);
    if nSemiColons == -1 then
    ListBox.AddItem("N_ListBoxAudioDevices", "Playback "..nCountOut..": "..sAudioOutDevices.." (Default Device)", "");
    else
    nDefaultOut = 1;
    nStop = 0;
    while nStop ~= 1 do
    if nDefaultOut == 1 then
    ListBox.AddItem("N_ListBoxAudioDevices", "Playback "..nCountOut..": "..String.Left(sAudioOutDevices, nSemiColons-1).." (Default Device)", "");
    nDefaultOut = 0;
    nCountOut = nCountOut + 1;
    else
    ListBox.AddItem("N_ListBoxAudioDevices", "Playback "..nCountOut..": "..String.Left(sAudioOutDevices, nSemiColons-1), "");
    nCountOut = nCountOut + 1;
    end
    sAudioOutDevicesTrimmed1 = String.TrimLeft(sAudioOutDevices, String.Left(sAudioOutDevices, nSemiColons-1));
    sAudioOutDevicesTrimmed2 = String.TrimLeft(sAudioOutDevicesTrimmed1, ";");
    sAudioOutDevices = sAudioOutDevicesTrimmed2;
    nSemiColons = String.Find(sAudioOutDevices, ";;", 1, false);
    if nSemiColons == -1 then
    ListBox.AddItem("N_ListBoxAudioDevices", "Playback "..nCountOut..": "..sAudioOutDevices, "");
    nStop = 1;
    nCountOut = nCountOut + 1;
    end
    end
    end
    else
    ListBox.AddItem("N_ListBoxAudioDevices", "No playback devices detected", "");
    end
    -- Get a list of all installed recording WDM audio devices
    sAudioInDevices = DLL.CallFunction("AutoPlay\\Docs\\WaveInOutDev.dll ", "GetWaveInDevs", "", DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)
    nCountIn = 1;
    if sAudioInDevices ~= "" then
    nSemiColons = String.Find(sAudioInDevices, ";;", 1, false);
    if nSemiColons == -1 then
    ListBox.AddItem("N_ListBoxAudioDevices", "Record "..nCountIn..": "..sAudioInDevices.." (Default Device)", "");
    else
    nDefaultIn = 1;
    nStop = 0;
    while nStop ~= 1 do
    if nDefaultIn == 1 then
    ListBox.AddItem("N_ListBoxAudioDevices", "Record "..nCountIn..": "..String.Left(sAudioInDevices, nSemiColons-1).." (Default Device)", "");
    nDefaultIn = 0;
    nCountIn = nCountIn + 1;
    else
    ListBox.AddItem("N_ListBoxAudioDevices", "Record "..nCountIn..": "..String.Left(sAudioInDevices, nSemiColons-1), "");
    nCountIn = nCountIn + 1;
    end
    sAudioInDevicesTrimmed1 = String.TrimLeft(sAudioInDevices, String.Left(sAudioInDevices, nSemiColons-1));
    sAudioInDevicesTrimmed2 = String.TrimLeft(sAudioInDevicesTrimmed1, ";");
    sAudioInDevices = sAudioInDevicesTrimmed2;
    nSemiColons = String.Find(sAudioInDevices, ";;", 1, false);
    if nSemiColons == -1 then
    ListBox.AddItem("N_ListBoxAudioDevices", "Record "..nCountIn..": "..sAudioInDevices, "");
    nStop = 1;
    nCountIn = nCountIn + 1;
    end
    end
    end
    else
    ListBox.AddItem("N_ListBoxAudioDevices", "No record devices detected", "");
    end
    -- Get the operating system information
    sOSName = System.GetOSName();
    tOSVersionInfo = System.GetOSVersionInfo();
    sOSServicePack = tOSVersionInfo.CSDVersion;
    if (sOSName == "Windows Vista") then
    Label.SetText("N_LabelOSText", "Microsoft "..sOSName);
    elseif (sOSName == "Windows 95") then
    Label.SetText("N_LabelOSText", "Microsoft "..sOSName);
    elseif (sOSName == "Windows 98") then
    Label.SetText("N_LabelOSText", "Microsoft "..sOSName);
    elseif (sOSName == "Windows NT 3") then
    Label.SetText("N_LabelOSText", "Microsoft "..sOSName);
    elseif (sOSName == "Windows NT 4") then
    Label.SetText("N_LabelOSText", "Microsoft "..sOSName.." "..sOSServicePack.."");
    elseif (sOSName == "Windows ME") then
    Label.SetText("N_LabelOSText", "Microsoft "..sOSName);
    elseif (sOSName == "Windows Server 2003") then
    if tOSVersionInfo.Enterprise then
    Label.SetText("N_LabelOSText", "Microsoft "..sOSName.." Enterprise ("..sOSServicePack..")");
    elseif tOSVersionInfo.SmallBusiness then
    Label.SetText("N_LabelOSText", "Microsoft "..sOSName.." Small Business ("..sOSServicePack..")");
    else
    Label.SetText("N_LabelOSText", "Microsoft "..sOSName.." Standard ("..sOSServicePack..")");

    if (sOSName == "Windows Vista") then
    Label.SetText("Labell0", "Microsoft: "..sOSName.." "..sOSServicePack.."");
    elseif tOSVersionInfo.Basic then
    Label.SetText("Labell0", "Microsoft: "..sOSName.." Home Basic "..sOSServicePack.."");
    elseif tOSVersionInfo.Premium then
    Label.SetText("Labell0", "Microsoft: "..sOSName.." Home Premium "..sOSServicePack.."");
    elseif tOSVersionInfo.Business then
    Label.SetText("Labell0", "Microsoft: "..sOSName.." Business "..sOSServicePack.."");
    elseif tOSVersionInfo.Ultimate then
    Label.SetText("Labell0", "Microsoft: "..sOSName.." Ultimate "..sOSServicePack.."");
    elseif tOSVersionInfo.Enterprize then
    Label.SetText("Labell0", "Microsoft: "..sOSName.." Enterprise "..sOSServicePack.."");
    end
    end


    elseif (sOSName == "Windows XP") then
    Label.SetText("N_LabelOSText", "Microsoft "..sOSName.." Professional ("..sOSServicePack..")");
    elseif (sOSName == "Windows XP" and tOSVersionInfo.Personal) then
    Label.SetText("N_LabelOSText", "Microsoft "..sOSName.." Home ("..sOSServicePack..")");
    elseif (sOSName == "Windows 2000" and tOSVersionInfo.ProductType == 3) then
    Label.SetText("N_LabelOSText", "Microsoft "..sOSName.." Server ("..sOSServicePack..")");
    else
    Label.SetText("N_LabelOSText", "Microsoft "..sOSName.." ("..sOSServicePack..")");
    end
    -- Get the network information
    tLANInfo = System.GetLANInfo();
    sLANInfoHost = tLANInfo.Host;
    sLANInfoDomain = tLANInfo.Domain;
    sLANInfoUser = tLANInfo.User;
    sLANInfoIP = tLANInfo.IP;
    tUserInfo = System.GetUserInfo();
    Label.SetText("N_LabelComputerNameText", tLANInfo.Host);
    if tUserInfo.IsAdmin then
    Label.SetText("N_LabelCurrentUserText", tLANInfo.User.." (Local Administrator)");
    else
    Label.SetText("N_LabelCurrentUserText", tLANInfo.User);
    end
    Label.SetText("N_LabelIPAddressText", tLANInfo.IP);
    sWorkgroupName = DLL.CallFunction("AutoPlay\\Docs\\WGDomain.dll", "GetWGDomain", "", DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)
    Label.SetText("N_LabelWorkgroupText", sWorkgroupName);
    -- Get the display information
    tDisplayInfo = System.GetDisplayInfo();
    sDisplayWidth = tDisplayInfo.Width
    sDisplayHeight = tDisplayInfo.Height
    sDisplayColorDepth = tDisplayInfo.ColorDepth
    Label.SetText("N_LabelDisplayInfoText", sDisplayWidth.." x "..sDisplayHeight.." @ "..sDisplayColorDepth.."bit");
    end

    fGetComputerInfo()
    -------end get info----------------


    ------set progress bar for C: drive use------------
    Progress.SetCurrentPos("Progress1", 0);

    tsize = Drive.GetSize("C");

    --Label.SetText("user.RegOrganization", "Drive Size: "..tsize);

    --get C: drive used space and save it in usize variable.
    usize = Drive.GetUsedSpace("C");
    fsize = Drive.GetFreeSpace("C");
    fsizef = String.GetFormattedSize(fsize*1048576, FMTSIZE_AUTOMATIC, true);
    used = (tsize-fsize)
    used = String.GetFormattedSize(used*1048576, FMTSIZE_AUTOMATIC, true);
    --usize = String.GetFormattedSize(usize, FMTSIZE_AUTOMATIC, true);

    Label.SetText("Label2", "Free Space:"..fsizef);
    upercent = Math.Floor((usize/tsize)*100)
    --divide the total size by 2 to get half way point
    --tsizehalf = tsize/2
    nintypercent = .90
    seventyfive = .75


    if (usize/tsize > nintypercent) then
    barcolor = 255
    elseif (usize/tsize < seventyfive) then
    barcolor = 65280
    elseif (usize/tsize > seventyfive) then
    barcolor = 65535
    end


    Progress.SetProperties("Progress1", {MinRange = 0, MaxRange = 100, BarColor = barcolor, TooltipText = upercent.." %"});
    --set current position of progress using variable usize.
    Progress.SetCurrentPos("Progress1", upercent);
    tsizeb = String.GetFormattedSize(tsize*1048576, FMTSIZE_AUTOMATIC, true);

    Label.SetText("driveinfo", "Drive Capacity:" ..tsizeb.."\r\nUsed Space: "..used);
    -- Get a list of the available drives.
    tDrives = Drive.Enumerate();

    if tDrives then
    for i,driveInfo in tDrives do
    ComboBox.AddItem("ComboBox1", driveInfo, driveInfo);
    end
    end
    CBDATA = ComboBox.GetItemData("ComboBox1", 1);
    if CBDATA ~= nil then
    disnamea = Drive.GetInformation(CBDATA);
    if disnamea ~= nil then
    ComboBox.SetItemText("ComboBox1", 1, disnamea.DisplayName);
    end
    end
    CBDATAb = ComboBox.GetItemData("ComboBox1", 2);
    if CBDATAb ~= nil then
    disnameb = Drive.GetInformation(CBDATAb);
    if disnameb ~= nil then
    ComboBox.SetItemText("ComboBox1", 2, disnameb.DisplayName);
    end
    end
    CBDATAc = ComboBox.GetItemData("ComboBox1", 3);
    if CBDATAc ~= nil then
    disnamec = Drive.GetInformation(CBDATAc);
    if disnamec ~= nil then
    ComboBox.SetItemText("ComboBox1", 3, disnamec.DisplayName);
    end
    end
    CBDATAd = ComboBox.GetItemData("ComboBox1", 4);
    if CBDATAd ~= nil then
    disnamed = Drive.GetInformation(CBDATAd);
    if disnamed ~= nil then
    ComboBox.SetItemText("ComboBox1", 4, disnamed.DisplayName);
    end
    end
    CBDATAe = ComboBox.GetItemData("ComboBox1", 5);
    if CBDATAe ~= nil then
    disnamee = Drive.GetInformation(CBDATAe);
    if disnamee ~= nil then
    ComboBox.SetItemText("ComboBox1", 5, disnamee.DisplayName);
    end
    end
    CBDATAf = ComboBox.GetItemData("ComboBox1", 6);
    if CBDATAf ~= nil then
    disnamef = Drive.GetInformation(CBDATAf);
    if disnamef ~= nil then
    ComboBox.SetItemText("ComboBox1", 6, disnamef.DisplayName);
    end
    end
    CBDATAg = ComboBox.GetItemData("ComboBox1", 7);
    if CBDATAg ~= nil then
    disnameg = Drive.GetInformation(CBDATAg);
    if disnameg ~= nil then
    ComboBox.SetItemText("ComboBox1", 7, disnameg.DisplayName);
    end
    end
    CBDATAh = ComboBox.GetItemData("ComboBox1", 8);
    if CBDATAh ~= nil then
    disnameh = Drive.GetInformation(CBDATAh);
    if disnameh ~= nil then
    ComboBox.SetItemText("ComboBox1", 8, disnameh.DisplayName);
    end
    end
    CBDATAi = ComboBox.GetItemData("ComboBox1", 9);
    if CBDATAi ~= nil then
    disnamei = Drive.GetInformation(CBDATAi);
    if disnamei ~= nil then
    ComboBox.SetItemText("ComboBox1", 9, disnamei.DisplayName);
    end
    end
    CBDATAj = ComboBox.GetItemData("ComboBox1", 10);
    if CBDATAj ~= nil then
    disnamej = Drive.GetInformation(CBDATAj);
    if disnamej ~= nil then
    ComboBox.SetItemText("ComboBox1", 10, disnamej.DisplayName);
    end
    end
    ComboBox.SetSelected("ComboBox1", 1);
    --Image.SetOpacity("bk",100);

  • .74
    No longer a forum member
    • May 2009
    • 355

    #2
    Well.. that's a pretty long code so I didn't go through it, but if it worked in 7.5 and not in 8.0, then it's probably the loop.

    Read this:

    Comment

    • Cybergraph
      Indigo Rose Customer
      • Feb 2007
      • 1633

      #3
      Yes, as usual: "for index in tDrives do"

      Should be: "for index in pairs(tDrives) do"
      We are slowly invading your planet to teach lazy humans to read the user manual.
      But don't be scared: we are here to help.

      Comment

      • asusnet
        Forum Member
        • Aug 2007
        • 2

        #4
        I fix the "fgetComputerInfo" but now show me one more error message.... and i make the same changes and fix it!!

        Thank you for your support!!

        Comment

        Working...
        X