Sign in to follow this  
Followers 0
Sylv4r

Inetget and dropbox questions.

2 posts in this topic

Here is my dilemma, I have created a script that will just open tools of sorts for cleaning up systems. My question is surrounding how dropbox works with inetget, because when I save my script it works just fine but when it tries to save the file that inetget is pulling it just saves the html page where a click is required to download and not the actual file. My first thought is that since dropbox has upgraded there servers and not allowing public folders so I do not have a public link and the link I am giving my script requires a mouse click in order to save the file. As well as the progress bar does not work, any help would be greatly appreciated.

Func Get_Downloads()

   ; Save the downloaded file to the Tool-kit folder.
   Local $sFilePath = "C:\Tool-kit\Toolkit.zip"
   Local $hDownload = InetGet("https://www.dropbox.com/s/ay8ceozt6bn7num/Tool-kit.zip?dl=0", $sFilePath, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND)
   Local $FileSize = InetGetSize($hDownload)
   Local $ProgramName = "Tool-kit.zip"
   ;Retrieve the number of total bytes received and the filesize.
   Local $iBytesSize = InetGetInfo($hDownload, $INET_DOWNLOADREAD)
   Local $FileSize = FileGetSize($sFilePath)

   ; Wait for the download to complete by monitoring the filesize.
   Do
      $Percentage = InetGetInfo($hDownload, 0) * 100 / $FileSize
      ProgressSet($Percentage, Round($Percentage, 0) & "% Downloaded " & Round(InetGetInfo($hDownload, 0) / 61765, 2) & " of " & Round($FileSize / 61765, 2) & " MB", "Downloading " & $ProgramName)
      Sleep(250)
   Until InetGetInfo($hDownload, 2)
   Do
        Sleep(250)
   Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE)

   ; 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: " & $FileSize)
   FileWriteLine("C:\Tool-kit\technotes.txt", "Downloaded Tools to the pc.")
EndFunc

Share this post


Link to post
Share on other sites



I feel silly...... https://www.dropbox.com/en/help/167 Guess I should parse my url correctly. Autoit does not support redirects. Making sure you have the right parse is key as it's the difference between a preview page and direct download.

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
Sign in to follow this  
Followers 0