function Callback(strSource, strDestination, nCopied, nTotal, nFileCopied, nFileTotal) nPercent = Math.Round(nCopied / nTotal * 100, 0); StatusDlg.SetMeterRange(0, 100); StatusDlg.SetTitle(""); StatusDlg.SetMessage("Копирование"); StatusDlg.SetStatusText(strDestination); StatusDlg.SetMeterPos(nPercent); StatusDlg.ShowCancelButton(true, "Cancel"); if (StatusDlg.IsCancelled()) then Input.SetText("Input1", tblFiles[1]); 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); StatusDlg.Hide(); 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); StatusDlg.Hide(); end end end end local strOutDir = Shell.GetFolder(SHF_MYDOCUMENTS); local strOutFileName = "Глобальный передел"; SaveAs(strOutDir, strOutFileName); |