New azo-azomethine sensor, HL, has been synthesized and characterized using standard spectroscopic methods. HL was found to sense CN− and AcO− in DMSO and semi-aqueous media over other anions such as Fˉ, Clˉ, Brˉ, Iˉ, H2PO4ˉ and HSO4ˉ. The anions recognition ability of HL was also evaluated using UV-Vis absorption and 1H NMR spectroscopy. Importantly, HL can detect CNˉ and AcOˉ in DMSO even at 0.7 ppm and 1.3 ppm, respectively. The binding stoichiometry between HL and the mentioned anions was found to be 1:1 with binding constants of 8.81×103 M-1 and 3.64×104 M-1 for CN− and AcO−, respectively. Successfully, HL was used for detection of sodium diclofenac over the other opiate drugs such as codeine phosphate, noscapine hydrochloride, papaverine hydrochloride, and morphine sulfate. The designed chemosensor has also shown highly promising results for the qualitative and quantitative detection of sodium diclofenac in oral pills.