bStop = false; function Callback(strSource, strDestination, nCopied, nTotal) local nPercent = Math.Round(nCopied / nTotal * 100, 0); Progress.SetText("Progress1", Math.Round(nPercent, 0).."%"); Progress.SetCurrentPos("Progress1", nPercent); if (bStop) then File.Delete(strOutFile, false, false, false, nil); return false; else return true; end end function SaveAs(strOutDir, strOutFileName) strFileToCopy = "AutoPlay\\Videos\\data01.avi"; local strFiles = CommonDialogs.File(false, "Сохранить",strOutDir, "Видео файл (*.avi)|*.avi|", strOutFileName, "avi", false); if (strFiles ~= "CANCEL") then local tblFiles = WinApi.DelimitedStringToTable(strFiles, "|"); if (tblFiles) then if (File.DoesExist(tblFiles[1])) then local cBut = Dialog.Message("Сохранить как", tblFiles[1].."\r\nУже существует.\r\nЗаменить существующий файл?", MB_YESNO, MB_ICONQUESTION, MB_DEFBUTTON1); if (cBut == 6) then strOutFile = tblFiles[1]; StatusDlg.Show(MB_ICONNONE, false); File.Copy(strFileToCopy, tblFiles[1], true, true, false, true, Callback); else local strOutDir = String.SplitPath(tblFiles[1]).Drive..String.SplitPath(tblFiles[1]).Folder; local strOutFileName = String.SplitPath(tblFiles[1]).Filename SaveAs(strOutDir, strOutFileName); end else strOutFile = tblFiles[1]; StatusDlg.Show(MB_ICONNONE, false); File.Copy(strFileToCopy, tblFiles[1], true, true, false, true, Callback); end end end end local strOutDir = Shell.GetFolder(SHF_MYDOCUMENTS); local strOutFileName = "Глобальный передел"; SaveAs(strOutDir, strOutFileName); |