Contrary to popular belief, nobody actually does this with a script. Because it's it's easily countered by anyone with half a brain. Just like journal scan box poppers.
1, you have no idea when they will actually use the spell on you
2, if you're in a group you have no idea that they will actually cast it on you vs casting it on someone else
3, in both cases you're essentially slowing yourself down by stopping to cast and also using a cast timer that could be used for anything remotely useful.
but if you're still hell bent on getting a script to do this for you, then yeah journal scan will work. just when people start chasing you saying "In Por Ylem" and laughing as you constantly stop to cast a magic arrow on yourself.
You might consider carrying trapped boxes instead.