AL3X Posted March 2, 2008 Share Posted March 2, 2008 I think that something like a "speed monitor" in InetGet would be great Some thing like this: While 1 $URL = "www.myhost.com/myfile.exe" $FileName = "myfile.exe" $Label = GUICtrlCreateLabel("Kb/s", -1, -1, 100, 100) InetGet($URL, $FileName, $Label, 1, 1) WEnd And this will "GUICtrlSetData" the current download speed to the $Label. ? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 2, 2008 Moderators Share Posted March 2, 2008 (edited) I think that something like a "speed monitor" in InetGet would be great Some thing like this: While 1 $URL = "www.myhost.com/myfile.exe" $FileName = "myfile.exe" $Label = GUICtrlCreateLabel("Kb/s", -1, -1, 100, 100) InetGet($URL, $FileName, $Label, 1, 1) WEnd And this will "GUICtrlSetData" the current download speed to the $Label. ? There are a million of them... just look up: "@InetGetBytesRead" Edit Example: http://www.autoitscript.com/forum/index.ph...GetBytesRead%5C Edited March 2, 2008 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
AL3X Posted March 2, 2008 Author Share Posted March 2, 2008 (edited) Yes, I looked all of them, but I have a problem with a script....... ;medidor de velocidad ;$Time = @SEC ;$Bytes = Round(@InetGetBytesRead) ;While @SEC = $Time ;esto hace el problema de cancelacion !!! ;WEnd ;$NewBytes = Round(@InetGetBytesRead) ;medidor 2 ;$LastSize = 0 ;While @InetGetActive ;$LastSize = @InetGetBytesRead ;$speed = int((@InetGetBytesRead - $LastSize) /1000) ;$LastSize = @InetGetBytesRead ;WEnd ;medidor 3 ;$comienzo = TimerInit() ;$var1 = @InetGetBytesRead / 1024 ;$speed = Round($var1 / (TimerDiff($comienzo) / 1000)) and many more.... yes....I looked at them all.... Here is what I cant do: expandcollapse popup#include <GUIConstants.au3> #include <inet.au3> #include <String.au3> #Region ### START Koda GUI section ### Form=C:\Documents and Settings\AL3X\Escritorio\youtube.kxf $Interfaz = GUICreate("YouTuBe Downloader 2.0", 350, 186, -1, -1) $LinkDelVideo = GUICtrlCreateLabel("Link del video:", 8, 56, 73, 17) $Label1 = GUICtrlCreateLabel("Estado: ", 8, 8, 35, 16) $Estado = GUICtrlCreateLabel("Esperando...", 45, 8, 350, 16) $MedidorEstado = GUICtrlRead($Estado) $Label2 = GUICtrlCreateLabel("Velocidad:", 8, 25, 50, 16) $Velocidad = GUICtrlCreateLabel("0" & " Kb/s", 60, 25, 60, 16) $MedidorVelocidad = GUICtrlRead($Velocidad) $Label3 = GUICtrlCreateLabel("Tiempo restante:", 8, 41, 79, 16) $TiempoRestante = GUICtrLCreateLabel("0 sec", 89, 41, 50, 16) $MedidorTiempoRestante = GUICtrlRead($TiempoRestante) $Label4 = GUICtrlCreateLabel("Porciento completado: ", 150, 25, 110, 16) $MedidorPorcientoCompletado = GUICtrlCreateLabel("0 %", 257, 25, 40, 16) $Descargando = GUICtrlCreateLabel("Descargando:", 8, 112, 73, 17) $Convirtiendo = GUICtrlCreateLabel("Convirtiendo:", 8, 142, 73, 17) $DownloadLinkInput = GUICtrlCreateInput("", 8, 78, 250, 25) $BotonDescargar = GUICtrlCreateButton("Descargar", 264, 78, 75, 25, 0) ;$BotonCancelar = GUICtrlCreateButton("Cancelar", 341, 78, 75, 25, 0) $BarraDeProgreso = GUICtrlCreateProgress(88, 108, 250, 23) $BarraDeConversion = GUICtrlCreateProgress(88, 138, 250, 23) $MenuArchivo = GUICtrlCreateMenu("&Archivo") $MenuSalir = GUICtrlCreateMenuItem("Salir", $MenuArchivo) $MenuEdicion = GUICtrlCreateMenu("&Edicion") $MenuCortar = GUICtrlCreateMenuItem("Cortar", $MenuEdicion) $MenuCopiar = GUICtrlCreateMenuItem("Copiar", $MenuEdicion) $MenuPegar = GUICtrlCreateMenuItem("Pegar", $MenuEdicion) $MenuMasInfo = GUICtrlCreateMenu("Mas Info") $MenuAcercade = GUICtrlCreateMenuItem("Acerca de...", $MenuMasInfo) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $BotonDescargar GUICtrlSetState($DownloadLinkInput,$GUI_DISABLE) GUICtrlSetState($BotonDescargar,$GUI_DISABLE) $DownloadLink = GUICtrlRead($DownloadLinkInput) $CodigoFuenteWeb = _INetGetSource($DownloadLink) $TituloDelVideo = _StringBetween($CodigoFuenteWeb, "<title>YouTube - ", "</title>") $NombreComplementario=StringRegExp($CodigoFuenteWeb, "&t=(.*?)&", 3) $NombreParaGuardar=stringmid($DownloadLink,stringinstr($DownloadLink,"v=")+2) $RutaParaGuardar = (@TempDir & "\" & $NombreParaGuardar) ;FileSaveDialog("Guardar SWF","","Flash(*.swf)",-1,$NombreParaGuardar) If @error = 1 Then GUICtrlSetState($BotonDescargar,$GUI_ENABLE) GUICtrlSetState($DownloadLinkInput,$GUI_ENABLE) ContinueLoop EndIf If StringRight($RutaParaGuardar,4) <> ".swf" Then $RutaParaGuardar&=".swf" GUICtrlSetState($BotonDescargar,$GUI_ENABLE) GUICtrlSetData($BotonDescargar, "Cancelar") _Download("http://youtube.com/get_video?video_id=" & $NombreParaGuardar & "&t=" & $NombreComplementario[0],$RutaParaGuardar,$BarraDeProgreso) Case $MenuSalir Exit Case $MenuAcercade $AcercaDe = GUICreate("Acerca de...", 283, 234, -1, -1) GUISetIcon("D:\006.ico") $GroupBox1 = GUICtrlCreateGroup("", 8, 8, 265, 185) $Image1 = GUICtrlCreatePic("C:\Documents and Settings\AL3X\Escritorio\icono2.gif", 24, 24, 81, 73, BitOR($SS_NOTIFY,$WS_GROUP)) $Label1 = GUICtrlCreateLabel("Nombre: YoTuBe Downloader", 120, 24, 146, 17, $WS_GROUP) $Label2 = GUICtrlCreateLabel("Version: 2.0", 120, 48, 60, 17, $WS_GROUP) $Label4 = GUICtrlCreateLabel("Creador: AL3X-admin <alex1vip1@gmail.com>", 16, 160, 246, 17, $WS_GROUP) $Label3 = GUICtrlCreateLabel("Copyright: Todos los derechos reservados.", 16, 104, 251, 57, $WS_GROUP) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("&OK", 104, 200, 75, 25) GUISetState(@SW_SHOW) While 1 $respuestadeinterfaz2 = GUIGetMsg() Switch $respuestadeinterfaz2 Case $GUI_EVENT_CLOSE GUIDelete($AcercaDe) ExitLoop Case $Button1 GUIDelete($AcercaDe) ExitLoop EndSwitch WEnd EndSwitch WEnd Func _Download($DownloadLink,$RutaParaGuardar,$BarraDeProgreso=0) $TamanoOriginal = InetGetSize($DownloadLink) InetGet($DownloadLink,$RutaParaGuardar,1,1) If $BarraDeProgreso = 0 Then ProgressOn("","") Do ;si se cancela ;no cambiar nada de aqui !!! $msg = GUIGetMsg() If $msg = $BotonDescargar Then If MsgBox(292,"","Deseas cancelar ?") = 6 Then InetGet("abort") GUICtrlSetData($BotonDescargar, "Descargar") GUICtrlSetState($BotonDescargar, $GUI_ENABLE) GUICtrlSetState($DownloadLinkInput,$GUI_ENABLE) GUICtrlSetData($BarraDeProgreso, 0) GUICtrlSetData($DownloadLinkInput, "") GUICtrlSetData($Estado, "Esperando...") GUICtrlSetData($MedidorPorcientoCompletado, "0 %") ExitLoop EndIf EndIf ;definicion de variables ;$size1 = FileGetSize($RutaParaGuardar) $MBsize1 = FileGetSize($RutaParaGuardar) $inetget = @InetGetBytesRead $Porciento = (100 * $inetget ) / $TamanoOriginal $decimalplace = Round($Porciento) $decimalplaceMBsize1 = Round(@InetGetBytesRead / 1024) ;medidor de velocidad $Time = @SEC $Bytes = Round(@InetGetBytesRead) While @SEC = $Time ;esto hace el problema de cancelacion !!! WEnd $NewBytes = Round(@InetGetBytesRead) ;actualizacion de contadores If $BarraDeProgreso = 0 Then ProgressSet ($Porciento);, $decimalplace & "% " & "(" & $decimalplaceMBsize1 & ") Kb han sido bajados.") ;$PorcientoCon2decimas = Round($Porciento, 2) ;GUICtrlSetData($Estado, ("Descargando " & $TituloDelVideo[0])) ;GUICtrlSetData($MedidorPorcientoCompletado, $PorcientoCon2decimas & " %") ;GUICtrlSetData($Velocidad,($NewBytes - $Bytes) /1024 & " Kb/s") ;GUICtrlSetData($Velocidad, $speed) Sleep(50) Else GUICtrlSetData($BarraDeProgreso,$Porciento) $PorcientoCon2decimas = Round($Porciento, 2) GUICtrlSetData($Estado,("Descargando " & $TituloDelVideo[0])) GUICtrlSetData($MedidorPorcientoCompletado, $PorcientoCon2decimas & " %") GUICtrlSetData($Velocidad,($NewBytes - $Bytes) /1024 & " Kb/s") Sleep(50) EndIf Until @InetGetActive = 0 If $BarraDeProgreso = 0 Then ProgressOff () Return $RutaParaGuardar EndFunc I have a Label and I want to make the script to show the speed, but if I delete all the ";" from one of the speed monitors, the button "Cancel" cames "unclickable". I mean, I can click it, but it doesnt to nothing. The error is in line 130 /131. If comented, the cancel button is OK. Edited March 2, 2008 by AL3X Link to comment Share on other sites More sharing options...
Valik Posted March 2, 2008 Share Posted March 2, 2008 You didn't bother reading the stick in the request forum. In a way, that's good, you saved yourself from opening a pointless ticket on the issue tracker. Instead you created what is nothing more than a support request in the developer forum. In short, you need to put more effort into researching things before you post. Locking this for being in the wrong forum. Link to comment Share on other sites More sharing options...
Recommended Posts