Leaderboard
Popular Content
Showing content with the highest reputation on 10/04/2021 in all areas
-
2 points
-
Finally I get it works: ;~ https://www.autoitscript.com/forum/topic/178561-simple-web-downloader-with-progress-bar/?do=findComment&comment=1301321 #include <FileConstants.au3> #include <StringConstants.au3> #include "WinHttp.au3" Global $EXAMPLE_URL = "" Global $EXAMPLE_FILE = "" ;~ _Example(0) _Example(1) ;~ _Example(2) Func _Example($iMode) Local $hOpen = _WinHttpOpen() ; Initialize and get session handle Local $hConnect = _WinHttpConnect($hOpen, $EXAMPLE_URL, $INTERNET_DEFAULT_HTTPS_PORT) ; Get connection handle ;~ Local $CurrentOption = _WinHttpQueryOption($hConnect, $WINHTTP_OPTION_SECURITY_FLAGS) ;~ Local $Options = BitOR($CurrentOption, _ ;~ $SECURITY_FLAG_IGNORE_UNKNOWN_CA, _ ;~ $SECURITY_FLAG_IGNORE_CERT_CN_INVALID, _ ;~ $SECURITY_FLAG_IGNORE_CERT_DATE_INVALID) ;~ _WinHttpSetOption($hConnect, $WINHTTP_OPTION_SECURITY_FLAGS, $Options) ;~ If @error Then ConsoleWrite("! ---> @error=" & @error & " @extended=" & @extended & _ ;~ " : _WinHttpSetOption" & @CRLF) Local $hConnect = _WinHttpConnect($hOpen, $EXAMPLE_URL, $INTERNET_DEFAULT_HTTPS_PORT) ; Get connection handle Local $hRequest = _WinHttpOpenRequest($hConnect, Default, $EXAMPLE_FILE, Default, Default, Default, $WINHTTP_FLAG_SECURE) If @error Then ConsoleWrite("! ---> @error=" & @error & " @extended=" & @extended & _ " : _WinHttpOpenRequest" & @CRLF) _WinHttpSendRequest($hRequest) ; Send request _WinHttpReceiveResponse($hRequest) ; Wait for the response ProgressOn("Downloading", "In Progress...") Progress(_WinHttpQueryHeaders($hRequest, $WINHTTP_QUERY_CONTENT_LENGTH)) Local $sData If _WinHttpQueryDataAvailable($hRequest) Then ; Check if there is data available... While 1 $sChunk = _WinHttpReadData_Ex($hRequest, $iMode, Default, Default, Progress) If @error Then ExitLoop $sData &= $sChunk WEnd Else MsgBox(48, "Error", "Site is experiencing problems (or you).") EndIf Sleep(1000) ProgressOff() ; Close handles _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) ConsoleWrite("! BinaryLen($sData) = " & BinaryLen($sData) & @CRLF) Local $hFile = FileOpen(@ScriptDir & "\" & $EXAMPLE_FILE, $FO_OVERWRITE + $FO_CREATEPATH + $FO_BINARY + $FO_UTF8) FileWrite($hFile, $sData) FileClose($hFile) EndFunc ;==>_Example Func Progress($iSizeAll, $iSizeChunk = 0) Local Static $iMax, $iCurrentSize If $iSizeAll Then $iMax = $iSizeAll $iCurrentSize += $iSizeChunk If Not @compiled Then ConsoleWrite("! $iCurrentSize = " & $iCurrentSize & @CRLF) Local $iPercent = Round($iCurrentSize / $iMax * 100, 0) ProgressSet($iPercent, $iPercent & " %") EndFunc ;==>Progress Func _WinHttpReadData_Ex($hRequest, $iMode = Default, $iNumberOfBytesToRead = Default, $pBuffer = Default, $vFunc = Default) __WinHttpDefault($iMode, 0) __WinHttpDefault($iNumberOfBytesToRead, 8192) __WinHttpDefault($vFunc, 0) Local $tBuffer, $vOutOnError = "" If $iMode = 2 Then $vOutOnError = Binary($vOutOnError) Switch $iMode Case 1, 2 If $pBuffer And $pBuffer <> Default Then $tBuffer = DllStructCreate("byte[" & $iNumberOfBytesToRead & "]", $pBuffer) Else $tBuffer = DllStructCreate("byte[" & $iNumberOfBytesToRead & "]") EndIf Case Else $iMode = 0 If $pBuffer And $pBuffer <> Default Then $tBuffer = DllStructCreate("char[" & $iNumberOfBytesToRead & "]", $pBuffer) Else $tBuffer = DllStructCreate("char[" & $iNumberOfBytesToRead & "]") EndIf EndSwitch Local $sReadType = "dword*" If BitAND(_WinHttpQueryOption(_WinHttpQueryOption(_WinHttpQueryOption($hRequest, $WINHTTP_OPTION_PARENT_HANDLE), $WINHTTP_OPTION_PARENT_HANDLE), $WINHTTP_OPTION_CONTEXT_VALUE), $WINHTTP_FLAG_ASYNC) Then $sReadType = "ptr" Local $aCall = DllCall($hWINHTTPDLL__WINHTTP, "bool", "WinHttpReadData", _ "handle", $hRequest, _ "struct*", $tBuffer, _ "dword", $iNumberOfBytesToRead, _ $sReadType, 0) If @error Or Not $aCall[0] Then Return SetError(1, 0, "") If Not $aCall[4] Then Return SetError(-1, 0, $vOutOnError) If IsFunc($vFunc) Then $vFunc(0, $aCall[4]) Local $dBinary = DllStructGetData($tBuffer, 1) If $aCall[4] < $iNumberOfBytesToRead Then Switch $iMode Case 0 Return SetExtended($aCall[4], StringLeft($dBinary, $aCall[4])) Case 1 Return SetExtended($aCall[4], BinaryToString(BinaryMid($dBinary, 1, $aCall[4]), $SB_ANSI)) Case 2 Return SetExtended($aCall[4], BinaryMid($dBinary, 1, $aCall[4])) EndSwitch Else Switch $iMode Case 0, 2 Return SetExtended($aCall[4], $dBinary) Case 1 Return SetExtended($aCall[4], BinaryToString($dBinary, $SB_ANSI)) EndSwitch EndIf EndFunc ;==>_WinHttpReadData_Ex The problem was related to BinaryToString() which used $SB_UTF8 but $SB_ANSI should be used. Also thanks to @jugador for pointing me on the right track: I mean his post allow me to find out that proper settings are: Local $hConnect = _WinHttpConnect($hOpen, $EXAMPLE_URL, $INTERNET_DEFAULT_HTTPS_PORT) ; Get connection handle Local $hRequest = _WinHttpOpenRequest($hConnect, Default, $EXAMPLE_FILE, Default, Default, Default, $WINHTTP_FLAG_SECURE)2 points
-
1 point
-
This: Local $hConnect = _WinHttpConnect($hOpen, "https://MY_URL", $INTERNET_DEFAULT_HTTPS_PORT) Local $hRequest = _WinHttpOpenRequest($hConnect, Default, "MY_FILE", Default, Default, Default, $WINHTTP_FLAG_SECURE) partially solve the problem. I mean progress bar was showed longer, downloading was in progress, but the downloaded data was not the same which I expected. This particular file is grather then fiel saved to disc. EDIT 1: using: Func Progress($iSizeAll, $iSizeChunk = 0) Local Static $iMax, $iCurrentSize If $iSizeAll Then $iMax = $iSizeAll $iCurrentSize += $iSizeChunk ConsoleWrite("! $iCurrentSize = " &$iCurrentSize & @CRLF) Local $iPercent = Round($iCurrentSize / $iMax * 100, 0) ProgressSet($iPercent, $iPercent & " %") EndFunc ;==>Progress and: ConsoleWrite("! BinaryLen($sData) = " & BinaryLen($sData) & @CRLF) Local $hFile = FileOpen(@ScriptDir & "\MY_FILE", $FO_OVERWRITE + $FO_CREATEPATH + $FO_BINARY) FileWrite($hFile, $sData) FileClose($hFile) I see in console: EDIT 2: using: $sChunk = _WinHttpReadData_Ex($hRequest, 1, Default, Default, Progress) using: $sChunk = _WinHttpReadData_Ex($hRequest, 2, Default, Default, Progress)1 point
-
try this way if not solve then I don't know Local $hConnect = _WinHttpConnect($hOpen, "https://MY_URL", $INTERNET_DEFAULT_HTTPS_PORT) Local $hRequest = _WinHttpOpenRequest($hConnect, Default, "MY_FILE", Default, Default, Default, $WINHTTP_FLAG_SECURE) or try adding _WinHttpSetOption ;~ WinHttp SetOption to use SECURE PROTOCOL TLS1.1 or TLS1.2 _WinHttpSetOption($hOpen, $WINHTTP_OPTION_SECURE_PROTOCOLS, _ BitOR($WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1, $WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2))1 point
-
Version 1.5.0
1,064 downloads
A gui splash screen. Themed after the famous MS Office Suite. Three colours to choose from, Red, Blue and Green. You can change the labels to your own application. Animated side scrolling dots just like MS does. Also bundled with this is the KODA form. So you can open up and see the basic structure of this splash screen.1 point -
Thanks for sharing. Let me share with you another example using WinHTTP.au3 > https://www.autoitscript.com/forum/topic/84133-winhttp-functions/ A friend gave this code to me a while ago while helping me. #include "WinHttp.au3" ; Download some gif ;~ http://33.media.tumblr.com/dd3ffab90cc338666f192fd86f6a4f8f/tumblr_n0pefhIpss1swyb6ao1_500.gif ; Initialize and get session handle $hOpen = _WinHttpOpen() ; Get connection handle $hConnect = _WinHttpConnect($hOpen, "http://33.media.tumblr.com") ; Specify the reguest $hRequest = _WinHttpOpenRequest($hConnect, Default, "dd3ffab90cc338666f192fd86f6a4f8f/tumblr_n0pefhIpss1swyb6ao1_500.gif") ; Send request _WinHttpSendRequest($hRequest) ; Wait for the response _WinHttpReceiveResponse($hRequest) ;~ ConsoleWrite(_WinHttpQueryHeaders($hRequest) & @CRLF) ProgressOn("Downloading", "In Progress...") Progress(_WinHttpQueryHeaders($hRequest, $WINHTTP_QUERY_CONTENT_LENGTH)) Local $sData ; Check if there is data available... If _WinHttpQueryDataAvailable($hRequest) Then While 1 $sChunk = _WinHttpReadData_Ex($hRequest, Default, Default, Default, Progress) If @error Then ExitLoop $sData &= $sChunk Sleep(20) WEnd Else MsgBox(48, "Error", "Site is experiencing problems (or you).") EndIf Sleep(1000) ProgressOff() ; Close handles _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) ; Do whatever with data, write to some file or whatnot. I'll just print it to console here: ConsoleWrite($sData & @CRLF) Local $hFile = FileOpen(@DesktopDir & "\test.gif", 26) FileWrite($hFile, $sData) FileClose($hFile) Func Progress($iSizeAll, $iSizeChunk = 0) Local Static $iMax, $iCurrentSize If $iSizeAll Then $iMax = $iSizeAll $iCurrentSize += $iSizeChunk Local $iPercent = Round($iCurrentSize / $iMax * 100, 0) ProgressSet($iPercent, $iPercent & " %") EndFunc Func _WinHttpReadData_Ex($hRequest, $iMode = Default, $iNumberOfBytesToRead = Default, $pBuffer = Default, $vFunc = Default) __WinHttpDefault($iMode, 0) __WinHttpDefault($iNumberOfBytesToRead, 8192) __WinHttpDefault($vFunc, 0) Local $tBuffer, $vOutOnError = "" If $iMode = 2 Then $vOutOnError = Binary($vOutOnError) Switch $iMode Case 1, 2 If $pBuffer And $pBuffer <> Default Then $tBuffer = DllStructCreate("byte[" & $iNumberOfBytesToRead & "]", $pBuffer) Else $tBuffer = DllStructCreate("byte[" & $iNumberOfBytesToRead & "]") EndIf Case Else $iMode = 0 If $pBuffer And $pBuffer <> Default Then $tBuffer = DllStructCreate("char[" & $iNumberOfBytesToRead & "]", $pBuffer) Else $tBuffer = DllStructCreate("char[" & $iNumberOfBytesToRead & "]") EndIf EndSwitch Local $sReadType = "dword*" If BitAND(_WinHttpQueryOption(_WinHttpQueryOption(_WinHttpQueryOption($hRequest, $WINHTTP_OPTION_PARENT_HANDLE), $WINHTTP_OPTION_PARENT_HANDLE), $WINHTTP_OPTION_CONTEXT_VALUE), $WINHTTP_FLAG_ASYNC) Then $sReadType = "ptr" Local $aCall = DllCall($hWINHTTPDLL__WINHTTP, "bool", "WinHttpReadData", _ "handle", $hRequest, _ "struct*", $tBuffer, _ "dword", $iNumberOfBytesToRead, _ $sReadType, 0) If @error Or Not $aCall[0] Then Return SetError(1, 0, "") If Not $aCall[4] Then Return SetError(-1, 0, $vOutOnError) If IsFunc($vFunc) Then $vFunc(0, $aCall[4]) If $aCall[4] < $iNumberOfBytesToRead Then Switch $iMode Case 0 Return SetExtended($aCall[4], StringLeft(DllStructGetData($tBuffer, 1), $aCall[4])) Case 1 Return SetExtended($aCall[4], BinaryToString(BinaryMid(DllStructGetData($tBuffer, 1), 1, $aCall[4]), 4)) Case 2 Return SetExtended($aCall[4], BinaryMid(DllStructGetData($tBuffer, 1), 1, $aCall[4])) EndSwitch Else Switch $iMode Case 0, 2 Return SetExtended($aCall[4], DllStructGetData($tBuffer, 1)) Case 1 Return SetExtended($aCall[4], BinaryToString(DllStructGetData($tBuffer, 1), 4)) EndSwitch EndIf EndFunc Now this is how you download a file with progessbar1 point
-
That _NTP_FT function seems not to work behind a proxy. I use this function to get the date which should be accurate. #include <Array.au3> Global $iError = 0, $oErrorChk = ObjEvent("AutoIt.Error", "ObjErrChk") $aResult = GetDateFromINet() If @error Then ConsoleWrite("Error connecting to internet!" & @CRLF) Else _ArrayDisplay($aResult) EndIf Func GetDateFromINet($bProxy = False, $sProxy = "", $sURL = "http://www.google.com/") Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") If $iError Then Return SetError(1, 0, 0) If $bProxy Then $oHttp.SetProxy(2, $sProxy) $oHTTP.Open("GET", $sURL, False) $oHTTP.Send() If $iError Then Return SetError(2, 0, 0) Local $sDate = $oHTTP.GetResponseHeader("Date") Local $sYear = StringRegExpReplace($sDate, ".+,\s*\d+\s*\w+\s*(20\d+)\s*.*", "$1") Local $iMonth, $aMonth[13] = [12, "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dez"] $iMonth = _ArraySearch($aMonth, StringRegExpReplace($sDate, ".+,\s*\d+\s*(\w+)\s*20\d+\s*.*", "$1")) Local $iDay, $aDay[8] = [7, "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] $iDay = StringRegExpReplace($sDate, ".+,\s*(\d+)\s*\w+\s*20\d+\s*.*", "$1") $oHTTP = Null Local $aDate[3] = [$sYear, StringFormat("%02i", $iMonth), StringFormat("%02i", $iDay)] Return $aDate EndFunc Func ObjErrChk() $iError += 1 ConsoleWrite($oErrorChk.scriptline & @CRLF) ConsoleWrite($oErrorChk.windescription & @CRLF) ConsoleWrite($oErrorChk.number & " / " & Hex($oErrorChk.number) & @CRLF) EndFunc1 point
-
File Stream Functions 08/12/2013
mLipok reacted to jaberwacky for a topic
I cooked up this file stream thingy. I don't like continually dealing with the file stuff. I found it helpful, so I figured someone else might too. It doesn't display any amazing code acrobatics but whatever. To use it just feed it a path to a file and call it repeatedly. The next line in the file is returned. To close a file before the EOF is reached then call the same function with $file_stream_close. Update: [05/15/2014] -- Reduced code duplication. [unknown date] -- Added string stream read functions and their corresponding constants. Didn't do the string write functions because it's kind of even less pointless than these already are. Functions: file_stream_read_line file_stream_read_char file_stream_append_line file_stream_append_char file_stream_overwrite_line file_stream_overwrite_char string_stream_read_line string_stream_read_char Constants: $file_stream_close $file_stream_eof $file_stream_other_error $string_stream_close $string_stream_eos $string_stream_delim_not_found Stream.au3 #AutoIt3Wrapper_AU3Check_Parameters=-w 1 -w 2 -w 3 -w 4 -w 6 -w 7 -d #include-once #include <File.au3> #region ; String Stream Global Const $string_stream_close = -2 Global Const $string_stream_eos = -1 Global Const $string_stream_delim_not_found = -1 ; Internal Global Const $string_stream_ready = -3 Func __string_stream_test(Const $string, ByRef $string_array) Switch $string Case $string_stream_close $string_array = $string_stream_ready Return True EndSwitch Return False EndFunc Func string_stream_read_line(Const $string) Local Static $string_array = StringSplit($string, @LF) If __string_stream_test($string, $string_array) Then Return True Local Static $element = 0 Select Case $string_array = $string_stream_ready $string_array = StringSplit($string, @LF) $element = 0 ContinueCase Case Not @error $element += 1 Switch $element > $string_array[0] Case True $string_array = $string_stream_ready $element = 0 Return SetError($string_stream_eos, 0, False) EndSwitch Return $string_array[$element] Case $string_stream_delim_not_found $string_array = $string_stream_ready $element = 0 Return SetError($string_stream_delim_not_found, 0, False) EndSelect EndFunc Func string_stream_read_char(Const $string) Local Static $string_array = StringSpLit($string, '') If __string_stream_test($string, $string_array) Then Return True Local Static $element = 0 Select Case $string_array = $string_stream_ready $string_array = StringSplit($string, '') $element = 0 ContinueCase Case Not @error $element += 1 Switch $element > $string_array[0] Case True $string_array = $string_stream_ready $element = 0 Return SetError($string_stream_eos, 0, False) EndSwitch Return $string_array[$element] Case $string_stream_delim_not_found $string_array = $string_stream_ready $element = 0 Return SetError($string_stream_delim_not_found, 0, False) EndSelect EndFunc #endregion #region ; File Stream Global Const $file_stream_close = -2 Global Const $file_stream_eof = -1 Global Const $file_stream_other_error = 1 ; Internal Global Const $file_stream_ready = -3 Global Const $file_stream_open_error = -1 Func __file_stream_test(Const $path, ByRef $file_open) Switch $path Case $file_stream_close FileClose($file_open) $file_open = $file_stream_ready Return True EndSwitch Return False EndFunc Func file_stream_read_line(Const $path) Local Static $file_open = FileOpen($path, $FO_READ) If __file_stream_test($path, $file_open) Then Return True Select Case $file_open = $file_stream_open_error $file_open = $file_stream_ready Return SetError(2, 1, False) Case $file_open = $file_stream_ready $file_open = FileOpen($path, $FO_READ) Switch $file_open Case $file_stream_open_error $file_open = $file_stream_ready Return SetError(2, 2, False) EndSwitch ContinueCase Case $file_open >= 0 Local Const $file_line = FileReadLine($file_open) Switch @error Case 0 Return $file_line Case $file_stream_eof FileClose($file_open) $file_open = $file_stream_ready Return SetError($file_stream_eof, 0, False) Case $file_stream_other_error FileClose($file_open) $file_open = $file_stream_ready Return SetError($file_stream_other_error, 0, False) EndSwitch EndSelect EndFunc Func file_stream_read_char(Const $path) Local Static $file_open = FileOpen($path, $FO_READ) If __file_stream_test($path, $file_open) Then Return True Select Case $file_open = $file_stream_open_error $file_open = $file_stream_ready Return SetError(2, 1, False) Case $file_open = $file_stream_ready $file_open = FileOpen($path, $FO_READ) Switch $file_open Case $file_stream_open_error $file_open = $file_stream_ready Return SetError(2, 2, False) EndSwitch ContinueCase Case $file_open >= 0 Local Const $file_line = FileRead($file_open, 1) Switch @error Case 0 Return $file_line Case $file_stream_eof FileClose($file_open) $file_open = $file_stream_ready Return SetError($file_stream_eof, 0, False) Case $file_stream_other_error $file_open = $file_stream_ready Return SetError($file_stream_other_error, 0, False) EndSwitch EndSelect EndFunc Func file_stream_overwrite_line(Const $line, Const $path) Local Static $file_open = FileOpen($path, $FO_OVERWRITE) Switch $path Case $file_stream_close FileClose($file_open) $file_open = $file_stream_ready Return True EndSwitch Select Case $file_open = $file_stream_open_error $file_open = $file_stream_ready Return SetError(2, 1, False) Case $file_open = $file_stream_ready $file_open = FileOpen($path, $FO_READ) Switch $file_open Case $file_stream_open_error Return SetError(2, 2, False) EndSwitch ContinueCase Case $file_open >= 0 Local Const $file_line = FileWriteLine($file_open, $line) Switch @error Case 0 Return $file_line Case $file_stream_eof FileClose($file_open) $file_open = $file_stream_ready Return SetError($file_stream_eof, 0, False) Case $file_stream_other_error $file_open = $file_stream_ready Return SetError($file_stream_other_error, 0, False) EndSwitch EndSelect EndFunc Func file_stream_overwrite_char(Const $char, Const $path) Local Static $file_open = FileOpen($path, $FO_OVERWRITE) Switch $path Case $file_stream_close FileClose($file_open) $file_open = $file_stream_ready Return True EndSwitch Select Case $file_open = $file_stream_open_error $file_open = $file_stream_ready Return SetError(2, 1, False) Case $file_open = $file_stream_ready $file_open = FileOpen($path, $FO_READ) Switch $file_open Case $file_stream_open_error $file_open = $file_stream_ready Return SetError(2, 2, False) EndSwitch ContinueCase Case $file_open >= 0 Local Const $file_line = FileWrite($file_open, $char) Switch @error Case 0 Return $file_line Case $file_stream_eof FileClose($file_open) $file_open = $file_stream_ready Return SetError($file_stream_eof, 0, False) Case $file_stream_other_error $file_open = $file_stream_ready Return SetError($file_stream_other_error, 0, False) EndSwitch EndSelect EndFunc Func file_stream_append_line(Const $line, Const $path) Local Static $file_open = FileOpen($path, $FO_APPEND) Switch $path Case $file_stream_close FileClose($file_open) $file_open = $file_stream_ready Return True EndSwitch Select Case $file_open = $file_stream_open_error $file_open = $file_stream_ready Return SetError(2, 1, False) Case $file_open = $file_stream_ready $file_open = FileOpen($path, $FO_READ) Switch $file_open Case $file_stream_open_error $file_open = $file_stream_ready Return SetError(2, 2, False) EndSwitch ContinueCase Case $file_open >= 0 Local Const $file_line = FileWriteLine($file_open, $line) Switch @error Case 0 Return $file_line Case $file_stream_eof FileClose($file_open) $file_open = $file_stream_ready Return SetError($file_stream_eof, 0, False) Case $file_stream_other_error $file_open = $file_stream_ready Return SetError($file_stream_other_error, 0, False) EndSwitch EndSelect EndFunc Func file_stream_append_char(Const $char, Const $path) Local Static $file_open = FileOpen($path, $FO_APPEND) Switch $path Case $file_stream_close FileClose($file_open) $file_open = $file_stream_ready Return True EndSwitch Select Case $file_open = $file_stream_open_error $file_open = $file_stream_ready Return SetError(2, 1, False) Case $file_open = $file_stream_ready $file_open = FileOpen($path, $FO_READ) Switch $file_open Case $file_stream_open_error $file_open = $file_stream_ready Return SetError(2, 2, False) EndSwitch ContinueCase Case $file_open >= 0 Local Const $file_line = FileWrite($file_open, $char) Switch @error Case 0 Return $file_line Case $file_stream_eof FileClose($file_open) $file_open = $file_stream_ready Return SetError($file_stream_eof, 0, False) Case $file_stream_other_error $file_open = $file_stream_ready Return SetError($file_stream_other_error, 0, False) EndSwitch EndSelect EndFunc #endregion Example: Local Const $path = "[YOUR PATH HERE]" Local $file_stream = '' Do $file_stream = file_stream_read_line($path) Switch @error Case $file_stream_close, $file_stream_other_error ExitLoop Case Else ConsoleWrite("File: " & $file_stream & @CRLF) EndSwitch Until False Enjoy!1 point -
Let's see how to listen to internet radio station using minimum resources plus just a little bit more, not to be too boring. Script: LiveStreaming.au3 You can take a look on how shanet used it to make a little radio application Streaming is done with WM ASF Reader Filter. Additional info can be found on MSDN. Link if you would be interested. AutoItObject is requirement. That UDF is located here or to be more precise here (download link).1 point