Error mensaje de Error

Aquí puedes preguntar o compartir tus dudas y conocimientos acerca del programa
BUen dia compañeros,

Tengo el siguiente codigo:

local tbChecks ={}
local tblNodes = {"1","1.1","1.2","1.3","2","2.1","2.2","3","3.1","3.2","4","4.1","4.2","4.3","4.4","4.5","5","5.1","5.2","5.3","6","6.1","6.2","6.3","7","7.1","8","8.1","8.2","8.3","8.4","8.5","8.6","9","9.1","9.2","9.3","9.4","9.5","10","10.1","10.2","10.3","11","11.1","11.2","11.3","12","12.1","12.2","13","13.1","13.2","13.3","13.4","13.5","13.6","14","14.1","14.2","14.3","14.4","15","15.1","15.2","15.3","16","16.1","16.2","16.3","16.4"}
n=1
--Debug.Clear()
if tbChecks then
	for i,Node in pairs	(tblNodes) do
		tNode =Tree.GetNode("Tree1",Node);
		if tNode.Checked == true then
		   tbChecks[n]={Ind=Node,Data=tNode.Data}
		   n=n+1
		end
	
	end
	
	 	   if tNode.Checked == 0 and Checket then
           elseif not Checket then
 		   Label.SetVisible("CountIntall", false)
  		   Progress.SetVisible("Progress1", false)
  		   Dialog.Message("Error", "No se ha seleccionado ningún programa para instalar");
 	       end

	
end

		Audio.Load(CHANNEL_NARRATION, "AutoPlay\\Audio\\Voces\\iniciando.mp3", true, false);
		
		Paragraph.SetVisible("Paragraph1", true);
		Progress.SetVisible("Progress1", true);
		Label.SetVisible("CountIntall", true)
		Label.SetVisible("Downloaded", true);
		Label.SetVisible("ProgressDownloaded", true);
		Image.SetVisible("Image4", true)
		Image.SetVisible("Image1", true)

	for count=1,Table.Count(tbChecks) do
		Path = tbChecks[count]["Data"]
		FTPWI.Download(Path, "C:\\Windows\\Temp\\Downloads\\exe.exe", "User", "pass", MODE_TEXT, 20, 21, true, DownloadFunction);
		Complete = Label.GetText("ProgressDownloaded");
		result = File.Run("C:\\Windows\\Temp\\Downloads\\exe.exe", "", "", SW_SHOWNORMAL, true);
		xt = result ; 
		
	end
 	 	
		if xt~=true then
		Label.SetVisible("CountIntall", false)
		Paragraph.SetVisible("Paragraph1", false);
		Progress.SetVisible("Progress1", false);
		Label.SetVisible("Downloaded", false);
		Label.SetVisible("ProgressDownloaded", false);
		Image.SetVisible("Image4", false)
		Image.SetVisible("Image1", false)
		Audio.Load(CHANNEL_NARRATION, "AutoPlay\\Audio\\Voces\\Completado.mp3", true, false);
        Dialog.Message("Completado", "Ha finalizado la instalación de los programas seleccionados", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
        
       end
 	


El error esta en este pedaso:

	 	   if tNode.Checked == 0 and Checket then
           elseif not Checket then
 		   Label.SetVisible("CountIntall", false)
  		   Progress.SetVisible("Progress1", false)
  		   Dialog.Message("Error", "No se ha seleccionado ningún programa para instalar");
 	       end


Cuando se oprime el boton instalar sin seleccionar nada del tree, aparece el mensaje pero luego aparece lo que se cumple en esta parte:

if xt~=true then
      Label.SetVisible("CountIntall", false)
      Paragraph.SetVisible("Paragraph1", false);
      Progress.SetVisible("Progress1", false);
      Label.SetVisible("Downloaded", false);
      Label.SetVisible("ProgressDownloaded", false);
      Image.SetVisible("Image4", false)
      Image.SetVisible("Image1", false)
      Audio.Load(CHANNEL_NARRATION, "AutoPlay\\Audio\\Voces\\Completado.mp3", true, false);
        Dialog.Message("Completado", "Ha finalizado la instalación de los programas seleccionados", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
        
       end


Lo que deseo es que si oprimen el boton instalar sin seleccionar nada en el tree, aparezca el unico mensaje de error que debe aparecer y no todos los 2 mensajes.

DE igual manera me podrian por favor indicar como limpio el tree despues de completarse toda la instalacion? o que quede el tree como si hubieran ingresado por primera vez.

Gracias
Simple, declara la bariable xt como false

                   if tNode.Checked == 0 and Checket then
           elseif not Checket then
                   Label.SetVisible("CountIntall", false)
                   Progress.SetVisible("Progress1", false)
                   Dialog.Message("Error", "No se ha seleccionado ningún programa para instalar");
                   xt = false
               end

if xt~=true then 
      Label.SetVisible("CountIntall", false)
      Paragraph.SetVisible("Paragraph1", false);
      Progress.SetVisible("Progress1", false);
      Label.SetVisible("Downloaded", false);
      Label.SetVisible("ProgressDownloaded", false);
      Image.SetVisible("Image4", false)
      Image.SetVisible("Image1", false)
      Audio.Load(CHANNEL_NARRATION, "AutoPlay\\Audio\\Voces\\Completado.mp3", true, false);
        Dialog.Message("Completado", "Ha finalizado la instalación de los programas seleccionados", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
        
       end
dowsher escribió:Simple, declara la bariable xt como false

                   if tNode.Checked == 0 and Checket then
           elseif not Checket then
                   Label.SetVisible("CountIntall", false)
                   Progress.SetVisible("Progress1", false)
                   Dialog.Message("Error", "No se ha seleccionado ningún programa para instalar");
                   xt = false
               end

if xt~=true then 
      Label.SetVisible("CountIntall", false)
      Paragraph.SetVisible("Paragraph1", false);
      Progress.SetVisible("Progress1", false);
      Label.SetVisible("Downloaded", false);
      Label.SetVisible("ProgressDownloaded", false);
      Image.SetVisible("Image4", false)
      Image.SetVisible("Image1", false)
      Audio.Load(CHANNEL_NARRATION, "AutoPlay\\Audio\\Voces\\Completado.mp3", true, false);
        Dialog.Message("Completado", "Ha finalizado la instalación de los programas seleccionados", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
        
       end

Compañero me sigue apareciendo el mensaje de error y luego el de que se instalaron los programas seleccionados, como puedo arreglar eso?

Tambien como limpio el tree cuando acabe todo de instalar?

Gracias