PDA

View Full Version : file.copy error "Operation aborted by user."



jcuster
03-22-2005, 09:00 AM
I am getting this error when I trace my SF7 program "Operation aborted by user." I a'm trying to create a custom progress screen for a copy command.

I have fought and fought this with no consistant results but this is the most recent error.

By the way. The trace did not not show the copy going to the callback(fileprogress) until I'm made my most recent set of changes.

--debugging script
Debug.SetTraceMode(true);
Debug.ShowWindow(true);

--Status Show
StatusDlg.Show(MB_ICONNONE, true);
StatusDlg.ShowProgressMeter(true);
StatusDlg.ShowCancelButton(false, "Cancel");

-- Note: this is normally where you would put the actions
-- that you want this screen to perform (i.e. the
-- actions that you want to show the progress of).

-- Tip: use the DlgProgressBar actions (such as SetRange,
-- SetPos and Step) to make the progress bars reflect
-- the current status of your actions.
-- These actions are performed whenever progress is made while the setup is installing files.

-- copy files here.
Folder.Create("H:\\"..BCKUPDIR);
Folder.Create("H:\\"..BCKUPDIR.."\\My Documents\\");
MDF = Shell.GetFolder(SHF_MYDOCUMENTS);
File.Copy(MDF.."\\*.*", "H:\\"..BCKUPDIR.."\\My Documents\\", true, true, false, true, fileprogress);


--defined function to display files

function fileprogress(tSource, tDestination, tCopied, tTotal, tFileCopied, tFileTotal)

shortsource = String.AbbreviateFilePath(tSource, 72);


StatusDlg.SetMeterRange(1, tTotal);

StatusDlg.SetStatusText(shortsource);
StatusDlg.SetMeterPos(tCopied);

return false

end

Brett
03-22-2005, 09:12 AM
Move the fileprogress function above the File.Copy call. The problem is that the File.Copy is being called before the callback function is defined and therefore you are passing through nil as the function argument since it is undefined.

jcuster
03-23-2005, 10:46 AM
Way cool! I got most everything fixed, even the "duh" mistakes. I also changed the actions in the function "fileprogress" so that I can use Progress screen with two bars..

My ego has gone through the roof.

Thanks Brett!!