Jump to content

Inetget and dropbox questions.


 Share

Recommended Posts

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...