function FindCallBack(CurrentPath) StatusDlg.ShowCancelButton(true, "Отмена"); cancel = StatusDlg.IsCancelled(); if cancel then -- Кнопка Отмена нажата, останавливаем текущую операцию return false; else -- Кнопка Отмена не нажата, продолжаем return true; end end inst_path =""; file_search = "*.pdf"; -- Получаем список имеющихся приводов. tDrives = Drive.Enumerate(); -- Проверяем, нет ли ошибки. error = Application.GetLastError(); if (error ~= 0) then Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1); else -- все хорошо, продолжаем -- Создаем строку, состоящую из букв всех приводов и показываем её. -- all_drives = Table.Concat(tDrives, "\r\n"); -- Dialog.Message("Notice", "Below is a list of all of your current drives:\r\n"..all_drives); for i, drive in pairs(tDrives) do drive_type = Drive.GetType(drive); if (drive_type == DRIVE_REMOVABLE and Drive.GetSize(drive) ~= -1) then valid_drive = true; elseif (drive_type == DRIVE_FIXED or drive_type == DRIVE_REMOTE or drive_type == DRIVE_RAMDISK) then valid_drive = true; else valid_drive = false; end if (valid_drive) then StatusDlg.Show(MB_ICONNONE, false); tSearch = File.Find(drive, file_search, true, false, nil, FindCallBack); StatusDlg.Hide(); if (tSearch) then for index, path in pairs(tSearch) do inst_path = inst_path..path.."\r\n"; end end end end end Debug.ShowWindow(true); -- показываем окно отладки Debug.Print(inst_path); -- выводим в окно отладки результаты |