Script to change default scanner response

Is there a way to change the contents of the default scanner confirmation box based on what it scans? like, if scan = x then show okay, if scan = y then show not okay.

Second question, is it possible to hide the default scanneer confirmation box completely? (I would then throw a notification in the screen with some contents)

@ram1689

I assume you are talking about this confirmation box:

Unfortunately there is no native way to do this. One option I can suggest here is to toggle on 'Automatically close after scan':

And then to throw a notification on close: