The fact that you said that Pokemon Spork uses the 16.2 version of Pokemon Essentials actually helps me in my search, as I know I saw a script for Spectral Thief for that version. Give me a moment to find it.
Try this page, 10th post down, 2nd script box: https://www.pokecommunity.com/showthread.php?t=383035&page=3
The only thing I'm not sure of is whether or not that script takes into account the fact that Spectral Thief bypasses Substitute. Because that is indeed confirmed by Bulbapedia and Serebii.net
(Which, by the way, I think is one of the most salty things in Pokemon ever. Makes me chuckle just thinking about that.)