Jump to content
Sign in to follow this  


Recommended Posts


will URLDownloadToFile create the directory in it's second parameter if it doesn't already exist?

example: URLDownloadToFile ( "URL", "c:\downloads\folder_that_wasn't_there" )

here's the code I'm using it in... The URLDownloadtoFile appears to run, I see the tooltip, but I can't find the files...

   script to download latest build, backup existing install and install latest build.
   grabs the following files from $szBaseURL

$szBaseURL = "http://www.autoitscript.com/autoit3/files/unstable/autoit/"
$szDownloadDir = @ScriptDir & "\download"
$szAutoItFolder = @ProgramFilesDir & "\AutoIt3"

;download latest build

getfile($szBaseURL & "Aut2Exe.exe", "new\Aut2Exe.exe")
getfile($szBaseURL & "AutoIt.chm", "new\AutoIt.chm")
getfile($szBaseURL & "AutoIt3.exe", "new\Aut2exe\AutoIt3.exe")
getfile($szBaseURL & "AutoItSC.bin", "new\Aut2exe\AutoItSC.bin")
MsgBox(0,"after getfile","still here")

;backup existing version to folder of version name
BackupCurrent($szAutoItFolder & "\Aut2Exe.exe")
BackupCurrent($szAutoItFolder & "\AutoIt.chm")
BackupCurrent($szAutoItFolder & "\Aut2Exe\AutoIt3.exe")
BackupCurrent($szAutoItFolder & "\Aut2Exe\AutoItSC.bin")
MsgBox(0,"after backupcurrent","still here")
;copy downloaded files

Func getfile($szFile, $szTarget)
   If Not FileExists($szDownloadDir) Then
   TrayTip("Downloading...", $szFile, 10)
   URLDownloadToFile($szBaseURL & $szfile,$szDownloadDir & "\" & $szTarget)
EndFunc  ;==>getfile

func BackupCurrent($szFile)
   $szVer = FileGetVersion(@ProgramFilesDir & "\AutoIt3\Autoit3.exe")
  ;MsgBox(0,"ver","ver is" & $szVer)
   $szBackupDir = "backup\" & $szVer
  ;MsgBox(0,"backupdir","backupdir is" & $szBackupDir)
   if not FileExists($szBackupDir) Then
     ;   MsgBox(0,"dir","dir created")
   TrayTip("Backing up...", $szFile, 30)
   FileCopy($szFile , $szBackupDir)
EndFunc  ;==>BackupCurrent
Edited by emmanuel

"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post

Link to post
Share on other sites

I concur, given that I can't find those files anywhere... will do a dircreate and then work in some error checking

"I'm not even supposed to be here today!" -Dante (Hicks)

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.