Muhammad_Awais_Sharif

UrlDownloadEx run in background

3 posts in this topic

Hi

I want to run  UrlDownloadEx  run in background so GUI don't hang.

It should give response During Downloading any file with this udf.

Please Help me 
Thank you 

 

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

okay thank you for reply :D
 

Edited by Muhammad_Awais_Sharif

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

    • leb
      By leb
      Hello there,
      I am using the function InetGet example in the help files on a website and getting the error 13. First, I searched the help files and the forum for a list of errors to consult to no avail. I suspect this is a 400's server reply based error but it would be nice to get more info about it.
      Please help, thanks.
      L
    • Dante_t
      By Dante_t
      Hi Guys, I need help. I have searched the forum before posting and i couldn't find anything. The code below works fine when downloading files from "http" sites, but when trying to download from "https" sites, no files are downloaded. I tried different sites and I experience the same problem everywhere. Is there something I'm missing or doing wrong? Please note that I'm not a programmer and I'm new to this. I'm just using logic wherever i can to get things done. your help will be highly appreciated.
       
      #include <InetConstants.au3>
      #include <MsgBoxConstants.au3>
      #include <WinAPIFiles.au3>
      ; Download a file in the background.
      ; Wait for the download to complete.

      Example()
      Func Example()
          ; Save the downloaded file to the temporary folder.
          Local $sFilePath = "d:\"
          ; Download the file in the background with the selected option of 'force a reload from the remote site.'
          Local $hDownload = InetGet("https://en.wikipedia.org/wiki/HTTPS#/media/File:Internet2.jpg", $sFilePath& "Internet2.jpg", $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND)
          ; Wait for the download to complete by monitoring when the 2nd index value of InetGetInfo returns True.
          Do
              Sleep(250)
          Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE)
          ; Retrieve the number of total bytes received and the filesize.
          Local $iBytesSize = InetGetInfo($hDownload, $INET_DOWNLOADREAD)
          Local $iFileSize = FileGetSize($sFilePath&"Internet2.jpg")
          ; Close the handle returned by InetGet.
          InetClose($hDownload)
          ; Display details about the total number of bytes read and the filesize.
          MsgBox($MB_SYSTEMMODAL, "", "The total download size: " & $iBytesSize & @CRLF & _
                  "The total filesize: " & $iFileSize)
          ; Delete the file.
          ;FileDelete($sFilePath)
      EndFunc   ;==>Example
       
    • swatsapkraz
      By swatsapkraz
      First script here. Thanks for taking the time.
      I want to download a file from my dropbox or other cloud file host and I want autoit to read the file and proceed.
      Here are the references I've gone through, it's just I'm not familiar yet with autoit so I'm looking for advice:
      https://www.autoitscript.com/autoit3/docs/functions/InetGet.htm
      https://www.autoitscript.com/autoit3/docs/functions/FileRead.htm
       
      How would I start out downloading a text file from dropbox and if in the file there is a 1 then it will proceed with the rest of the script if there is a 0 or if the file cannot be downloaded I want it to just end.
       
      Thank you for taking the time to read this and I apologize in advance if this seems very trivial for some but this is my first script and I'm hoping this is the correct place to ask this question.
    • FengHuangWuShen
      By FengHuangWuShen
      So I was playing with INet and downloading files and made a simple video downloader, or it can even be used for any file really.
      Just follow the reference section in INet_Settings.ini , and then run the script.
       
      Main Script #include <INet.au3> #include <InetConstants.au3> #include <WinAPIFiles.au3> #include <Array.au3> #include <String.au3> OnAutoItExitRegister('INET_CLOSE') $GET_URL = _INetGetSource(IniRead(@ScriptDir & '\Inet_Settings.ini', 'Request', 'Url', Default)) $STRING_START = IniRead(@ScriptDir & '\Inet_Settings.ini', 'Data', 'Start', Default) $STRING_END = IniRead(@ScriptDir & '\Inet_Settings.ini', 'Data', 'End', Default) $GET_STRING = _StringBetween ($GET_URL, $STRING_START, $STRING_END) $VIDEO_URL = _ArrayToString($GET_STRING) $VIDEO = _URIDecode($VIDEO_URL) If StringLen($VIDEO) > 0 Then Local $VIDEO_DIR = (@ScriptDir & '\' & Random(1, 65535) & '.mp4') Local $DOWNLOAD_VIDEO = InetGet($VIDEO, $VIDEO_DIR, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND) Do Sleep(IniRead(@ScriptDir & '\Inet_Settings.ini', 'Settings', 'Delay', Default)) Until InetGetInfo($DOWNLOAD_VIDEO, $INET_DOWNLOADCOMPLETE) InetClose($DOWNLOAD_VIDEO) Else MsgBox(0, 'DEBUG', "Video doesn't exist") EndIf Func INET_CLOSE() InetClose($DOWNLOAD_VIDEO) EndFunc Func _URIEncode($sData) ; Prog@ndy Local $aData = StringSplit(BinaryToString(StringToBinary($sData,4),1),"") Local $nChar $sData="" For $i = 1 To $aData[0] ; ConsoleWrite($aData[$i] & @CRLF) $nChar = Asc($aData[$i]) Switch $nChar Case 45, 46, 48 To 57, 65 To 90, 95, 97 To 122, 126 $sData &= $aData[$i] Case 32 $sData &= "+" Case Else $sData &= "%" & Hex($nChar,2) EndSwitch Next Return $sData EndFunc Func _URIDecode($sData) ; Prog@ndy Local $aData = StringSplit(StringReplace($sData,"+"," ",0,1),"%") $sData = "" For $i = 2 To $aData[0] $aData[1] &= Chr(Dec(StringLeft($aData[$i],2))) & StringTrimLeft($aData[$i],2) Next Return BinaryToString(StringToBinary($aData[1],1),4) EndFunc  
      INet_Settings.ini  URL - The target URL of the video you're trying to grab Data - This is the starting string, and ending string reference to look for the download URL itself. Settings - Only setting here currently, is the delay in which to wait for the file to download ### Reference for Start and End points for various websites [Request] Url = https://www.facebook.com/lindseystirlingmusic/videos/1527732263925622/ [Data] Start = hd_src_no_ratelimit:" End = " [Settings] Delay = 250 ################################################################################################### Instagram : https://www.instagram.com/p/Video ID Or : https://www.instagram.com/p/Video ID/?taken-by=User ID Start = video:secure_url" content=" End = " Facebook : https://www.facebook.com/User ID/videos/Video ID/ Or : Right click on the video and copy URL Start = hd_src_no_ratelimit:" End = " Start = sd_src_no_ratelimit:" End = " ###################################################################################################  
      Credits to : https://www.autoitscript.com/forum/profile/31965-progandy/  for the URL Encode and Decode.
    • drorshem
      By drorshem
      Hi,
      I'm looking to create a script which will download all *.txt files from a remote FTP server.
      Once downloaded, delete all *.txt files.
       
      Can this be achieved using AutoIt ?