Jump to content

how the solution for error does not spaced - (Moved)


Recommended Posts

I got a problem of Windows can't find the file referred to in the temporary directory, I have tried various ways still error : windows cannot find c:\............make sure you typed the name correctly...

#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Local $urls = "https://www.ohchr.org/sites/default/files/Documents/Publications/HR-PUB-14-2.pdf"

Local $urlsArray = StringSplit($urls,",",2)

for $url In $urlsArray
         $sFile = DownloadFile($url)
         shellExecute($sFile)

Next

Func DownloadFile($sURL)
    Local $hDownload, $sFile
    $sFile = StringRegExpReplace($sURL,"^.*/","")
    $sDirectory = @TempDir & $sFile
    $hDownload = InetGet($sURL, $sDirectory, 17, 1)
    InetClose($hDownload)
    Return $sDirectory
EndFunc   ;==> GetURLImage

ERROR.png

Link to post
Share on other sites
  • Developers
Posted (edited)

You start the download in the background but do not wait for it to finish and close it right away!

    $hDownload = InetGet($sURL, $sDirectory, 17, 1)

... and you are also missing a backslash between the tempdir and the outputfile!
Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites
  • Developers
Posted (edited)

The proper syntax for InetGet() is explained in the helpfile (also check out the example 2) and this line is your second issue:

$sDirectory = @TempDir & $sFile

that needs to be something like:

$sDirectory = @TempDir & "\" & $sFile

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...