# Disabling Trigger Buffering While a Task is Running

To disable trigger buffering while a Task is executing:

1. At the beginning of the Task, add a Script block with the following code:

       //Tells the task to ignore any incoming triggers from the camera
       $Tasks.Task.TriggerEnabled = false;

2. From the Project Explorer, right-click the Task and from the menu, select Script > On Complete.

   Configure the On Complete Script with the following code:

       var acqFifo = $System.GetInternalObject("Devices.Camera1") as Cognex.VisionPro.ICogAcqFifo;
       if (acqFifo != null)
       {
        acqFifo.Flush(); //Clear any images in the AcqFifo queue.
       }
       //Re-enable the task so that it responds to triggers again.
       $Tasks.Task.TriggerEnabled = true;