Jump to content
Wingens

Upload speed check

Recommended Posts

Wingens

Hi,

anyone got some experience with the  _NetInfo_GetUploadSpeed() from the NetInfo UDF.

Been fiddeling with it for a day now. and i keep getting a return: 1 or return 2, never get my upload in kb/s.

 

This is the little bit of my script i got:

 

$s_CountryCode = "NL"
        $Upload_Speed =  _NetInfo_GetUploadSpeed()

        MsgBox(4096, "Test", $Upload_Speed)

What am I not seeing here...

Share this post


Link to post
Share on other sites
Wingens

37 views, no posts...am I the first with this problem?

Maybe somebody used the _NetInfo UDF before and can help me explain what I am doing wrong.

 

I keep getting a return errorcode: 2

 

$CODE = __NetInfo_GetCountryCode()
         MsgBox(4096, "", "Countrycode: " & $CODE)
        $Countrycode = $CODE
        $Upload_Speed =  _NetInfo_GetUploadSpeed()

The message box shows my country code: NL

After that i use the country code to help select the server, this asfar as I understand the UDF...

Maybe someone can give me a tip or knows what I am doing wrong/forgetting...

Share this post


Link to post
Share on other sites
232showtime

too little & confusing information, that's why your not getting any help


ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Share this post


Link to post
Share on other sites
Wingens

Oh Oke, hope this helps...

what i am trying to accomplish is a hardware and network check, got all the parts done except for the upload speed check.
We are checking hardware and network connections for a cloud program.

Below you will find my code.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Inet.au3>
#include <WinAPIReg.au3>
#include <Security.au3>
#include <WinAPI.au3>
#include <NavInfo.au3>
#include <Netinfo.au3>
#include <Array.au3>
#include <smtpauth.au3>

#RequireAdmin

    If Not FileExists("C:\Temp") Then
        DirCreate("C:\Temp")
    EndIf
    If FileExists("C:\Temp\check.txt") Then
        FileDelete("C:\Temp\check.txt")
    EndIf
    $FILE       = FileOpen("C:\Temp\check.txt", 1)

    $DEBITGUI   = GUICreate("Bedrijfsnaam", 245, 108, -1, -1, $WS_POPUPWINDOW)
    $DEBITNR    = GUICtrlCreateInput("", 8, 32, 225, 21)
    GUICtrlCreateLabel("Wat is uw bedrijfsnaam?", 8, 8)
    $OK         = GUICtrlCreateButton("OK", 85, 72, 75, 25)
        GUISetState(@SW_SHOW, $DEBITGUI)
    While 1
        Switch GUIGetMsg()
            Case $OK
                $VAR = GUICtrlRead($DEBITNR)
                If $VAR <> "" Then
                    FileWrite($FILE, "Bedrijfsnaam:      " & $VAR & @CRLF)
                    FileWrite($FILE, "Datum:             " & @MDAY & "-" & @MON & "-" & @YEAR & @CRLF)
                    FileClose($FILE)
                    GUIDelete($DEBITGUI)
                    NAME()
                EndIf
                If $VAR = "" Then
                    MsgBox(4096, "Let Op!", "Bedrijfsnaam is verplicht.")
                EndIf
        EndSwitch
    WEnd

Func NAME()
    $FILE       = FileOpen("C:\Temp\check.txt", 1)
    $MEDEWERKERGUI  = GUICreate("Naam", 245, 108, -1, -1, $WS_POPUPWINDOW)
    $MEDEWERKER     = GUICtrlCreateInput("", 8, 32, 225, 21)
    GUICtrlCreateLabel("Controle is uitgevoerd door:", 8, 8)
    $OK         = GUICtrlCreateButton("OK", 85, 72, 75, 25)
        GUISetState(@SW_SHOW, $MEDEWERKERGUI)
    While 1
        Switch GUIGetMsg()
                Case $OK
                $VAR = GUICtrlRead($MEDEWERKER)
                If $VAR <> "" Then
                    FileWrite($FILE, "Uitgevoerd door:   " & $VAR & @CRLF & @CRLF)
                    FileClose($FILE)
                    GUIDelete($MEDEWERKERGUI)
                    CHECKS()
                EndIf
                If $VAR = "" Then
                    MsgBox(4096, "Let Op!", "Uw naam is verplicht.")
                EndIf
        EndSwitch
    WEnd
EndFunc

Func CHECKS()
    MsgBox(4096, "Let op!", "Test")
    $FILE = FileOpen("C:\Temp\check.txt", 1)

ProgressOn("Cloud - Check", "Gegevens verzamelen...")
    Sleep(3000)

    ProgressSet("11,11", "Uitlezen processor informatie...")
        Sleep(1500)
        $READPROC = RegRead("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0", "ProcessorNameString")
        $PROC = $READPROC

        FileWrite($FILE, "Processor:         " & $PROC & @CRLF)

    ProgressSet("22,22", "Uitlezen geheugen capaciteit...")
        Sleep(1500)

        Local $aMem = MemGetStats()
            $mem = $aMem[1] /1024
            $mem1= $mem /1024
            $mem2= Round($mem1, 0)

    $READRAM = $mem2 & " GB Geheugen"
        FileWrite($FILE, "Geheugen:          " & $READRAM & @CRLF)

    ProgressSet("33,33", "Uitlezen model gegevens...")
        Sleep(1500)

        $READMODEL1 = RegRead("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\Bios", "SystemManufacturer")
        $READMODEL2 = RegRead("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\Bios", "BaseBoardProduct")
    $READMODEL = $READMODEL1 & " " & $READMODEL2

        FileWrite($FILE, "Model:             " & $READMODEL & @CRLF)

    ProgressSet("44,44", "Uitlezen Windows versie...")
        Sleep(1500)
        $READOS = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductName")

        If @OSArch = "X86" Then
            $ARCH = "32-Bit"
        Else
            $ARCH = "64-Bit"
        EndIf
    $WINDOWS =$READOS & " " & $ARCH

        FileWrite($FILE, "Windows:           " & $WINDOWS & @CRLF)

    ProgressSet("55,55", "Uitlezen Internet Explorer versie...")
        Sleep(1500)

        Local $sVersion = FileGetVersion(@ProgramFilesDir & "\Internet Explorer\iexplore.exe")
        $IEVERSION = Round($sVersion, 0)
        $IE ="Internet Explorer: " & $IEVERSION
        $IEDONE     = StringTrimLeft($IE, 19)
        FileWrite($FILE, "Internet Explorer: " & $IEDONE & @CRLF)

    ProgressSet("66,66", "Uitlezen Silverlight versie...")
        Sleep(1500)
        $Silverlight_Version = _NavInfo_GetSilverlightVersion()
            If @error Then
                $SILVERLIGHT = "Silverlight: Niet aanwezig"
            EndIf
            If Not @error Then
                $SILVERLIGHT = "Silverlight: " & $Silverlight_Version
            EndIf
        $SILVERDONE = StringTrimLeft($SILVERLIGHT, 13)
        FileWrite($FILE, "Silverlight:       " & $SILVERDONE & @CRLF & @CRLF)

    ProgressSet("77,77", "Internet download snelheid testen, even geduld a.u.b.")
        Sleep(1500)

        $SPEEDCHECK = _NetInfo_GetDownloadSpeed()
            $VAR1 = _ArrayExtract($SPEEDCHECK, 1, 1)
            $VAR2 = _ArrayToString($VAR1, 1)
            $VAR3 = $VAR2 /100

        FileWrite($FILE, "Internet Snelheid: " & $VAR3 & " MBit Download" & @CRLF)

    ProgressSet("80", "Internet upload snelheid testen, even geduld a.u.b.")
        $CODE = __NetInfo_GetCountryCode()
            MsgBox(4096, "", "Countrycode: " & $CODE)
        $Countrycode = $CODE
        $Upload_Speed =  _NetInfo_GetUploadSpeed()

        FileWrite($FILE, "Internet Snelheid: " & $Upload_Speed & " Upload" & @CRLF)

    ProgressSet("90", "Opvragen IP-Adres, even geduld a.u.b.")
        Sleep(1500)
        $PublicIP = _GetIP()
        $IPADRES = $PublicIP

        FileWrite($FILE, "IP-Adres:          " & $IPADRES & @CRLF & @CRLF)

    ProgressSet("100", "Klaar.")
        Sleep(1500)
    ProgressOff()

    FileClose($FILE)

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • faustf
      By faustf
      hi guys how is possible set a speed of  all function _Ie ?? 
    • HardXOR
      By HardXOR
      Hello AutoIt community
      I run into speed problem in my script wich i cant solve myself, problem is with decoding texture loop - for better explanation, you need extract from file pallete (16x 16 RGB color) and picture data (224 * 128 byte), then use correct color for your picture data.... nothing extra hard and also texture is quite small 224*256
      it is for my car model viewer/later maybe editor GranTurismo 2 from Playstation 1, so its old dataformat and i cant understand why AutoIt take so long to decode texture when good old Playstation almost 2,5 decades old can do that nearly immediately (when you list through cars in shop or garage)
      My first atempt was create all trought dllstructure, because its easier approach, but it was soooo slow (40-50s for create textures) then i upgrade my routine via arrays, first 3D arrays later only 1D, next i put decoding colors outside loop but it is still not enough, my last version took cca 15s wich is still unacceptable for car model viewer when you click on one carmodel from listview (1100 cars for whole game) and you must wait 15-16s for model to load....  oh and i forgot mention some cars have more then 1 color (much more... 8-9-10 etc) soloading take 8-9-10 times more time
      in attachment i post texture file from GranTurismo 2 for one car (contain only 1 color) and also my dll struct version and array version code
      dll struct version - ± 40 sec (33 without saving)
      #include <FileConstants.au3> Global $IMDT[256][256][4] LoadTexture("ufs9r.cdp") Func LoadTexture($file) $fileHandle = FileOpen($file, $FO_BINARY) $header = FileRead($fileHandle, 0x20) ConsoleWrite("header> " & $header & @CRLF) $PAL = FileRead($fileHandle, 0x200) ConsoleWrite("PAL> " & $PAL & @CRLF) FileSetPos($fileHandle, 0x43A0, $FILE_BEGIN) $IMD = FileRead($fileHandle, 0x7000) ConsoleWrite("IMD> " & $IMD & @CRLF) $st = DllStructCreate("BYTE[512]") DllStructSetData($st, 1, $PAL) $struct_PAL = DllStructCreate("WORD[16];WORD[16];WORD[16];WORD[16];WORD[16];WORD[16];WORD[16];WORD[16];WORD[16];WORD[16];WORD[16];WORD[16];WORD[16];WORD[16];WORD[16];WORD[16]", DllStructGetPtr($st)) $struct_IMD = DllStructCreate("BYTE[" & 0x7000 & "]") DllStructSetData($struct_IMD, 1, $IMD) $start = TimerInit() For $i = 0 To 15 For $j = 0 To 223 $cn = 0 For $k = 0 To 127 $bt = DllStructGetData($struct_IMD, 1, $j * 128 + $k + 1) $blue = BitShift(DllStructGetData($struct_PAL, $i + 1, BitAND($bt, 0x0F) + 1), 7) $IMDT[$j][$cn][0] = $blue $green = BitShift(DllStructGetData($struct_PAL, $i + 1, BitAND($bt, 0x0F) + 1), 2) $IMDT[$j][$cn][1] = $green $red = BitShift(DllStructGetData($struct_PAL, $i + 1, BitAND($bt, 0x0F) + 1), - 3) $IMDT[$j][$cn][2] = $red If DllStructGetData($struct_PAL, $i + 1, BitAND($bt, 0x0F) + 1) = 0 Then $IMDT[$j][$cn][3] = 0x00 Else $IMDT[$j][$cn][3] = 0xFF EndIf $cn += 1 $blue = BitShift(DllStructGetData($struct_PAL, $i + 1, BitShift($bt, 4) + 1), 7) $IMDT[$j][$cn][0] = $blue $green = BitShift(DllStructGetData($struct_PAL, $i + 1, BitShift($bt, 4) + 1), 2) $IMDT[$j][$cn][1] = $green $red = BitAND(BitShift(DllStructGetData($struct_PAL, $i + 1, BitShift($bt, 4) + 1), - 3), 0xFF) $IMDT[$j][$cn][2] = $red If DllStructGetData($struct_PAL, $i + 1, BitShift($bt, 4) + 1) = 0 Then $IMDT[$j][$cn][3] = 0x00 Else $IMDT[$j][$cn][3] = 0xFF EndIf $cn += 1 Next Next saveTGA($i) Next ConsoleWrite("t " & TimerDiff($start) & @CRLF) ; +- 40 seconds FileClose($fileHandle) EndFunc Func saveTGA($name) Local $tga[18] = [0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x20, 0x20] Local $data for $i = 0 To 17 $data &= Hex($tga[$i], 2) Next For $i = 0 To 255 For $j = 0 To 255 For $k = 0 To 3 $data &= hex($IMDT[$i][$j][$k], 2) Next Next Next $binary = FileOpen("test\" & $name & ".tga", BitOR($FO_BINARY, $FO_OVERWRITE, $FO_CREATEPATH)) FileWrite($binary, "0x" & $data) FileClose($binary) EndFunc  
      array version - ± 15 sec (under 10s without saving)
      #include <FileConstants.au3> LoadTexture2("ufs9r.cdp") Func LoadTexture2($file) $fileHandle = FileOpen($file, $FO_BINARY) $a = TimerInit() Global $header[0x20] For $i = 0 To UBound($header) - 1 $header[$i] = Int(String(FileRead($fileHandle, 1))) ; read 0x20 bytes Next ConsoleWrite("header " & TimerDiff($a) & @CRLF) $a = TimerInit() Global $PAL[0x100] For $i = 0 To UBound($PAL) - 1 $PAL[$i] = Number(FileRead($fileHandle, 2)) ; read 0x200 (16*16) words Next Global $PALcolor[16 * 16 * 4] For $i = 0 To UBound($PAL) - 1 $PALcolor[$i * 4 + 0] = BitShift($PAL[$i], 7) $PALcolor[$i * 4 + 1] = BitShift($PAL[$i], 2) $PALcolor[$i * 4 + 2] = BitShift($PAL[$i], -3) If $PAL[$i] = 0 Then $PALcolor[$i * 4 + 3] = 0x00 Else $PALcolor[$i * 4 + 3] = 0xFF EndIf Next ConsoleWrite("PAL " & TimerDiff($a) & @CRLF) $a = TimerInit() FileSetPos($fileHandle, 0x43A0, $FILE_BEGIN) Global $IMD[0x7000] For $i = 0 To UBound($IMD) - 1 $IMD[$i] = Int(String(FileRead($fileHandle, 1))) ; read 0x7000 bytes Next ConsoleWrite("IMD " & TimerDiff($a) & @CRLF) Global $IMDT[256*256*4] $a = TimerInit() For $i = 0 To 15 For $j = 0 To 223 $cn = 0 For $k = 0 To 127 $byte = $IMD[$j * 128 + $k] ; byte for decode $index = $j * 1024 + $cn * 4 $index2 = $i * 0x40 + BitAND($byte, 0x0F) * 4 $IMDT[$index + 0] = $PALcolor[$index2 + 0] ; blue $IMDT[$index + 1] = $PALcolor[$index2 + 1] ; green $IMDT[$index + 2] = $PALcolor[$index2 + 2] ; red $IMDT[$index + 3] = $PALcolor[$index2 + 3] ; alpha $cn += 1 $index = $j * 1024 + $cn * 4 $index2 = $i * 0x40 + BitShift($byte, 4) * 4 $IMDT[$index + 0] = $PALcolor[$index2 + 0] ; blue $IMDT[$index + 1] = $PALcolor[$index2 + 1] ; green $IMDT[$index + 2] = $PALcolor[$index2 + 2] ; red $IMDT[$index + 3] = $PALcolor[$index2 + 3] ; alpha $cn += 1 Next Next ;~ $b = TimerInit() saveTGA2($i) ;~ ConsoleWrite("save TGA " & TimerDiff($b) & @CRLF) Next ConsoleWrite("full time " & TimerDiff($a) & @CRLF) ; 16 seconds FileClose($fileHandle) EndFunc Func saveTGA2($name) Local $tga[18] = [0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x20, 0x20] Local $data For $i = 0 To 17 $data &= Hex($tga[$i], 2) Next For $i = 0 To UBound($IMDT) - 1 $data &= Hex($IMDT[$i], 2) Next $binary = FileOpen("test\" & $name & ".tga", BitOR($FO_BINARY, $FO_OVERWRITE, $FO_CREATEPATH)) FileWrite($binary, "0x" & $data) FileClose($binary) EndFunc if anyone can optimize my code I would be very grateful, or pointing me to better solution, thx
      ufs9r.cdp
    • nacerbaaziz
      By nacerbaaziz
      Detect if the focus item is a button or check box
      Hello everyone.
      My dears I have a problem
      When I try to use
      ControlGetFocus function
      it  doesn't recognize the check  boxes.
      The result is that the selector is a button
      Although the specified is a check box
      but I want a way to identify the check boxes.
      Because I want to make a tool that helps screen readers users
      I hope you have the solution.
      Thank you in advance.
       
    • Triblade
      By Triblade
      Hi all,
       
      I was pondering over a question with regards to the speeds of reading something and did not see this kind of question in a forum search.
      The question: What is (technically) faster? Multiple reads from the same 3d array cell, or only once make a 'temp' variable from that cell and read the value from this? I don't know if either has any real impact at all anyway, but just wanted to ask anyway. :-)
       
      There may be a difference if the value holds an integer or a string (or something else) but in my case, is a simple integer.
      To hopefully clarify with a small bit of code:
      $process = $start - 15 If $xy[$process][3] <> "x" Then If _ArraySearch($open, $process, 1, $open[0][0], 0, 0, 1, 1) <> -1 Then UpdateOpen($xy[$process][5], $closed[0][0]) ElseIf $start > 0 And _ArraySearch($closed, $process, 1, $closed[0][0], 0, 0, 1, 0) = -1 Then Add_open($start, $closed[0][0], $counter, $process) EndIf EndIf You can read from this, that the array $closed[0][0] is being read 3 times. And this goes on further in the code I did not show.
      My question boils down to this, should I make a 'temp' variable to hold that $closed[0][0] value until the function is done?
       
      It may not have a real impact on my small script, but I really am interested in the answer at least.
       
      Regards,
      Tri.
    • ruslanas402
      By ruslanas402
      Greeting, so I've been trying to come up with solution, but no luck. Despite I tried to automate upload function, I released that it freezes after "Choose File to Upload" window appears..
       
      #include <IE.au3> ;#include <_Dbug.au3> Global $oIE = _IECreate("http://tinypic.com/", 1) Global $upload2 = _IEGetObjById($oIE, "the_file") _IEAction($upload2, "click") ;Sleep(1000) $hWnd = WinGetHandle("Choose File to Upload") MsgBox(0, "", $hWnd) Have anybody faced this situation?
      btw: srry for the advertise Besides it's no matter which site I'm trying to do this it's all the same.
×