This invention is an apparatus that, connected to a computer program, controls the process of filling of pills in trays for medicine dispensers or pillboxes with multiple chambers. The apparatus is characterized by applying a control scanner and a precision weight for precise dispensing of the pills and by gate templates to guide the pills to selected chambers in the target pillboxes. Target chambers are automatically selected according to the pre-determined ingestion time. The pills will remain in the gate-template until the operator has conducted a visual inspection and/or performed a semi-automatic camera control to verify that the pills are properly distributed in the openings of the gate template. After the verification process, the pills are released into medication tray, by means of a mechanical device with double barrier plates, which are activated by a specialized release mechanism.