Página 1 de 2

Estimated Time Copy (Callback)

Publicado: 14 Nov 2012 09:38
por Ceone
Estimated Time Copy (Callback)

Imagen

Buenas amigos de AMSSpecialist, el otro dia se me ocurrio la idea de hacer que un callback calcule el tiempo que a pasado y el restante, espero que os guste la idea y os ayude a perfeccionar vuestros proyectos.

Callback:
function CopyCallback(sSrcFile, sDstFile, nCopBytes, nTotBytes, nCopBytesCurFile, nTotBytesCurFile)
	if ayt == nil then
		ayt = Math.Floor(nTotBytes/100)
		tm1 = os.clock();
	end
	if _1a == nil then
		if nCopBytes > (ayt) then
			stimatedTotal = Math.Floor((os.clock()-tm1)*100);
			_1a = true;
		end
	end	
	if _10a == nil then
		if nCopBytes > (ayt*10) then
			stimatedTotal = Math.Floor((os.clock()-tm1)*10);
			_10a = true;
		end
	end
	if _50a == nil then
		if nCopBytes > (ayt*50) then
			stimatedTotal = Math.Floor((os.clock()-tm1)*2);
			_50a = true;
		end
	end

	stimated = Math.Floor((os.clock()-tm1));
	if stimatedTotal == nil then
		stimatedTotal = "calculated";
	end
	Paragraph.SetText("Paragraph1", "Time: "..stimated.." seconds of "..stimatedTotal.." seconds.");
end
Llamada:
result = Dialog.FolderBrowse("Please select a folder to copy:", "");
if result ~= "" then
	Folder.Create(_TempFolder.."\\estimated_temp");
	File.Copy(result.."\\*.*", _TempFolder.."\\estimated_temp\\", true, true, false, true, CopyCallback);
	
	Paragraph.SetText("Paragraph1", "Total Time: "..os.clock()-tm1.." seconds.");
	Folder.DeleteTree(_TempFolder.."\\estimated_temp", nil);
end
Ejemplo:
HIDE: ON
Hidebb Message Hidden Description

Re: Estimated Time Copy (Callback)

Publicado: 14 Nov 2012 14:18
por abood1987
thanks

Re: Estimated Time Copy (Callback)

Publicado: 14 Nov 2012 15:10
por rafaxplayer
way pablo

Re: Estimated Time Copy (Callback)

Publicado: 14 Nov 2012 20:37
por mecivic
Thank you

Re: Estimated Time Copy (Callback)

Publicado: 15 Nov 2012 00:28
por Haitham.2012
good ..!! thanks ceone

Re: Estimated Time Copy (Callback)

Publicado: 17 Nov 2012 12:13
por bariza-dz
thanks

Re: Estimated Time Copy (Callback)

Publicado: 19 Nov 2012 07:35
por sattel
Gracias

Re: Estimated Time Copy (Callback)

Publicado: 26 Dic 2012 23:01
por kLeVeR
muchas gracias :yes: :yes: :yes:

Re: Estimated Time Copy (Callback)

Publicado: 26 Dic 2012 23:36
por carsonzillo
molable tio molable!

Re: Estimated Time Copy (Callback)

Publicado: 20 Feb 2013 11:03
por lazybones
abriras

Re: Estimated Time Copy (Callback)

Publicado: 25 Feb 2013 21:32
por hitec
gracias..

Publicado: 25 May 2013 21:10
por FRAPIDS
:pc: ...

Publicado: 28 May 2013 12:26
por j2a2foros
gracias..

Publicado: 14 Jun 2013 03:29
por a.miguel
INteresante

Publicado: 17 Dic 2013 03:37
por noadricos
manda pra mim

Publicado: 17 Feb 2014 23:32
por omisterioo
nice xx

Re: Estimated Time Copy (Callback)

Publicado: 20 Abr 2015 16:45
por Ryuzaki
thanksssss

Re: Estimated Time Copy (Callback)

Publicado: 13 Jul 2015 14:08
por (NA3R)
thank u for best toipc

Re: Estimated Time Copy (Callback)

Publicado: 29 Ene 2016 05:10
por Ed Nieman
gracias

Re: Estimated Time Copy (Callback)

Publicado: 20 Jul 2017 08:04
por miguelangel_one
Muchas gracias