Piper7865 Posted September 8, 2015 Share Posted September 8, 2015 Hello All, I'm trying to create a script which checks for various stats on the computer to verify that the user has proper requirements for the job. I've mostly managed to figure out how to get everything else I want but the network speed test is giving me issues. I'm using the NetInfo functions which I found on here but I'm having trouble with the numbers its giving me. I've forced to accept Canada as the country code and tried without but it seems to give really low numbers compared to what I get if I were to go to speedtest.net and run the test from there. In the case of the upload its giving me very low. In my last test I got Down 8.216 and Up 0.024 the raw numbers would have been 1026 and 3 (which I then divide by 125 to get from kBps to Mbps ). Either way the numbers don't square up with what I usually hit on speedtest which is 25 down and 10 up (give or take). I have gotten close to matching the download but the upload is always very small. As well the latency function(before I took it out) doesn't return a value at all. Any suggestions? As well any other suggestions on my code will also be appreciated. expandcollapse popup#include <InetConstants.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <CompInfo.au3> #include <NetInfo.au3> Func _ComputerGetSoftware_mod(ByRef $aSoftwareInfo) Local Const $UnInstKey = "HKEY_LOCAL_MACHINE64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" Local $i = 1 Dim $aSoftwareInfo[1][4] While 1 $AppKey = RegEnumKey($UnInstKey, $i) If @error <> 0 Then ExitLoop ReDim $aSoftwareInfo[UBound($aSoftwareInfo) + 1][4] $aSoftwareInfo[$i][0] = StringStripWS(StringReplace(RegRead($UnInstKey & "\" & $AppKey, "DisplayName"), " (remove only)", ""), 3) $aSoftwareInfo[$i][1] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "DisplayVersion"), 3) $aSoftwareInfo[$i][2] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "Publisher"), 3) $aSoftwareInfo[$i][3] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "UninstallString"), 3) $i += 1 WEnd $aSoftwareInfo[0][0] = UBound($aSoftwareInfo, 1) - 1 If $aSoftwareInfo[0][0] < 1 Then SetError(1, 1, 0) EndIf EndFunc Func Getstats() Local $OSs Local $processors Local $drives Local $software Local $software64 Local $Download_Speed = _NetInfo_GetDownloadSpeed(9,"CA") ;download speed test using the netinfo function Local $Upload_Speed = _NetInfo_GetUploadSpeed() ;upload speed test using netinfo function Local $alternate = GetNetSpeed() Local $IEVER = FileGetVersion(@ProgramFilesDir & "\Internet Explorer\iexplore.exe") Local $permitted[7] = ["Standard" , "Professional" ,"Small Business" , "Professional Plus" , "Ultimate" , "Enterprise" , "Home and Business" ] $file = FileOpen("test.txt" , 1) _ComputerGetOSs($OSs) _ComputerGetProcessors($processors) _ComputerGetDrives($drives) If @OSArch == "X86" Then ; If the OS is an X86 type search only installed programs for an X86 OS otherwise we need to check both _ComputerGetSoftware($Software) FileWrite($file, "OS version = " & @OSVersion &@CRLF &@CRLF) FileWrite($file, "Is 64 or 32 Bit OS = " & @OSArch &@CRLF &@CRLF) FileWrite($file, "Visable Memory= " & Round($OSs[1][57] / 1000000 ,2) & "GB" &@CRLF &@CRLF) FileWrite($file, "Processor Name = " & StringStripWS($processors[1][0] ,2) &@CRLF &@CRLF) FileWrite($file, "Processor Speed = " & Round($processors[1][23] /1000,2) & "GHz" &@CRLF &@CRLF) FileWrite($file, "Total Drive space = " & Round($drives[1][5] / 1024, 2) & "GB" &@CRLF &@CRLF) FileWrite($file, "Free Drive Space = " & Round($drives[1][4] / 1024, 2) & "GB" &@CRLF &@CRLF) FileWrite($file, "Desktop Resolution = " & @DesktopWidth & "X" & @DesktopHeight &@CRLF &@CRLF ) FileWrite($file, "Internet Explorer Version = " & $IEVER &@CRLF &@CRLF) FileWrite ($file, "Network Speed = " & "Down " & $Download_Speed[0] / 125 & "Up " & $Upload_Speed / 125 &@CRLF &@CRLF) For $i = 1 To $Software[0][0] Step 1 If StringInStr($Software[$i][0] , "Microsoft Office") > 0 Then For $j = 0 To 6 Step 1 If StringInStr($Software[$i][0] , $permitted[$j]) > 0 Then FileWrite($file,"Name: " & $Software[$i][0] & @CRLF & _ "Version: " & $Software[$i][1] & @CRLF ) EndIf Next EndIf Next Else ; for X64 processors we need to check two locations for installed programs, one for x86 other for x64 _ComputerGetSoftware($Software) _ComputerGetSoftware_mod($Software64) FileWrite($file, "OS version = " & @OSVersion &@CRLF & @CRLF) FileWrite($file, "64 or 32 Bit OS = " & @OSArch &@CRLF & @CRLF) FileWrite($file, "Visable Memory= " & Round($OSs[1][57] / 1000000 ,2) & "GB" &@CRLF & @CRLF) FileWrite($file, "Processor Name = " & StringStripWS($processors[1][0] ,2) &@CRLF & @CRLF) FileWrite($file, "Processor Speed = " & Round($processors[1][23] / 1000 , 2) & "GHz" &@CRLF & @CRLF) FileWrite($file, "Total Drive space = " & Round($drives[1][5] / 1024, 2) & "GB" &@CRLF & @CRLF ) FileWrite($file, "Free Drive Space = " & Round($drives[1][4] / 1024, 2) & "GB" &@CRLF & @CRLF) FileWrite($file, "Desktop Resolution = " & @DesktopWidth & "X" & @DesktopHeight &@CRLF & @CRLF ) FileWrite($file, "Internet Explorer Version = " & $IEVER &@CRLF & @CRLF) FileWrite ($file, "Network Speed = " & "Down " & $Download_Speed[0] / 125 & "Up " & $Upload_Speed / 125 &@CRLF &@CRLF) For $i = 1 To $Software[0][0] Step 1 ;searches the x86 location for anything that says Microsoft Office if it passes that test then it checks the name against the permitted types If StringInStr($Software[$i][0] , "Microsoft Office") > 0 Then For $j = 0 To 6 Step 1 If StringInStr($Software[$i][0] , $permitted[$j]) > 0 Then FileWrite($file,"Name: " & $Software[$i][0] & @CRLF & _ "Version: " & $Software[$i][1] & @CRLF ) EndIf Next EndIf Next For $i = 1 To $Software64[0][0] Step 1 ; searches the 64 location for the same information .. amends a warning if it found 64 bit office If StringInStr($Software64[$i][0] , "Microsoft Office") > 0 Then For $j = 0 To 6 Step 1 If StringInStr($Software64[$i][0] , $permitted[$j]) > 0 Then FileWrite($file,"Name: " & $Software64[$i][0] & @CRLF & _ "Version: " & $Software64[$i][1] & @CRLF & _ "Warning 64 Bit Office Detected" & @CRLF) EndIf Next EndIf Next EndIf EndFunc Getstats() Link to comment Share on other sites More sharing options...
computergroove Posted September 11, 2015 Share Posted September 11, 2015 You could use ping - https://www.autoitscript.com/autoit3/docs/functions/Ping.htm and use the MS response time to gauge the result. You could also use this - http://www.fixedbyvonnie.com/2014/07/testing-internet-speed-command-line-pretty-cool/ Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Link to comment Share on other sites More sharing options...
Surya Posted September 11, 2015 Share Posted September 11, 2015 (edited) pinging is nice method (Simple) Edited September 11, 2015 by Surya No matter whatever the challenge maybe control on the outcome its on you its always have been. MY UDF: Transpond UDF (Sent vriables to Programs) , Utter UDF (Speech Recognition) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now