There is no reason to depend on shell scripts for this, when both AppleScript (using ASObjC) and KM native Actions/Tokens/Functions can easily tell you which screen contains the frontmost window.
I'm not sure what other suggestions to offer at this point, because I'm confused on what exactly your current objective is.
In your OP, you stated:
Has that question/goal been solved?
If so, please:
- Check the "Solved" checkbox (click for details) at the bottom of that post that best solves it.
- Post a new topic if you have other questions.
If not, please tell us specifically what the issue is, and post the script/macro that you are currently trying to make work.
Thanks.