Launch doc attachment in QueryOpen event using script

Situation: User double clicks document to open it in read mode. Document has a file attachment in one of the fields.

Under certain conditions, I want to launch the attachment that is on the document instead of opening the notes document itself.

I would like to code this using script in the QueryOpen event.

Anyone know how to do this?