Jump to content

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)

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...