Rather than rethinking the ux and rewriting portions of existing solutions to retrofit the functionality, a quick fix can be to put a condition in your script so that it chooses a document window for Webdirect and card for fmp.
Obviously that means you are willingly not using the now working as intended card window in Webdirect.