View Full Version : how can i do a progress bar in Zip.Add
how can i do a progress bar in Zip.Add?
Use the callback function, and you can set the status of a progress bar by the file, or by the whole process.
i wont to get the size of the new file and check it and set the progress bar but the zip.add get a temp file and i dont no whot file to chek?
i wont to do a timer thet chek the new file size and set the progress bar but i dont no the name of the file bekose the zip.add put a temp file
and i dont no how to work whit "callback function":huh
Use something like this as your callback:
function ZipCallBack(File, Percent, Status)
if Status == ZIP_STATUS_MAJOR then
-- update the over all progress bar
Progress.SetCurrentPos("OverAllProgress", Percent)
else
-- update the file's progress bar
Progress.SetCurrentPos("FileProgress", Percent)
end
end
http://www.indigorose.com/forums/showthread.php?t=12946&highlight=zip
but i dont andersten it and wer i put yor code?
the code run the progress bar in the zip.add
-- Display a single-selection file browse dialog
result = Dialog.FileBrowse(true, "Load File", _DesktopFolder, "Microsoft Word Document (*.zip)|*.zip|All Files (*.*)|*.*|", "", "", false, true);
-- If CANCEL was not chosen, then let's get the file path
if (result[1] ~= "CANCEL") then
Dialog.Message("You chose the following file", result[1]);
end
Zip.Add("C:\\2.Zip", result, true, "", 9, ZipCallBack, false);
function ZipCallBack(File, Percent, Status)
if Status == ZIP_STATUS_MAJOR then
-- update the over all progress bar
Progress.SetCurrentPos("Progress1", Percent)
else
-- update the file's progress bar
Progress.SetCurrentPos("Progress2", Percent)
end
end
i tray this code and its dont work to
-- Display a single-selection file browse dialog
result = Dialog.FileBrowse(true, "Load File", _DesktopFolder, "Microsoft Word Document (*.zip)|*.zip|All Files (*.*)|*.*|", "", "", false, true);
-- If CANCEL was not chosen, then let's get the file path
if (result[1] ~= "CANCEL") then
Dialog.Message("You chose the following file", result[1]);
end
Zip.Add("C:\\2.Zip", result, true, "", 9, ZipCallBack, false);
function ZipCallBack(File, Percent, Status)
result444 = Progress.GetCurrentPos("Progress2");
if Status == ZIP_STATUS_MAJOR then
-- update the over all progress bar
Progress.SetCurrentPos("Progress2", result444+1)
else
-- update the file's progress bar
Progress.SetCurrentPos("Progress2", result444+1)
end
end
function CallBack (sPath, nPercent, nStatus)
if nStatus == ZIP_STATUS_MAJOR then
Progress.SetCurrentPos("Progress1", nPercent);
end
end
tFiles = Zip.GetContents("AutoPlay\\Docs\\file.zip", false);
Zip.Extract("AutoPlay\\Docs\\file.zip", tFiles, _TempFolder, false, false, "", ZIP_OVERWRITE_ALWAYS, CallBack)
Functions need to be defined before they can be called. If you're not going to put the function in the "Global" area, then it needs to be in your code before you call it.
-- Good
function Test()
return "Good"
end
Dialog.Message("Sample", Test())
--BAD
Dialog.Message("Sample", Test())
function Test()
return "Bad"
end
function CallBack (sPath, nPercent, nStatus)
if nStatus == ZIP_STATUS_MAJOR then
Progress.SetCurrentPos("Progress1", nPercent);
end
end
dany = "c:\\1.doc";
ddd = {dany};
Zip.Add("c:\\1121.zip", ddd, true, "", 5, CallBack, true);
:huh please way the code dont work
I'd gladly help you, but I don't understand what you are asking or what is wrong. It'd be a lot easier if you posted an APZ for us to look at.
Ahhhh, I see the problem, you have recurse set to true, which makes the Zip.Add function look in every sub folder of the one specified, in this case C:\.
Change that to false, and you're good to go.
Zip.Add("c:\\test.zip", zipadd, true, "", 5, CallBack, false);
i fix this thenks but the new problem is the progress go to the end in 1 secend and zip.add stil work way?
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.