@iNik and @DanThomas, this is so great and saved me tons of time trying to configure this myself
a question arises though. @iNik, im using your implementation adding the script part to the html. Yet how does one address several html prompts with different sizes?
I tried changing the TestDefaultWindowSize
to a unique variable per prompt ie to ws_mailmate
, and adjusted that in the code with no success.
here is the current macro:
and the changed html script
<script>
function KMInit() {
window.addEventListener("resize", savePosition, true);
window.addEventListener("unload", savePosition, true); //this doesn't seem to work
}
function KMWindow() {
winBounds = window.KeyboardMaestro.GetVariable("savedTestWindowPosition");
if(!winBounds) {
winBounds = window.KeyboardMaestro.GetVariable("ws_mailmate");
}
return winBounds;
}
function savePosition() {
window.KeyboardMaestro.SetVariable('savedTestWindowPosition', [window.screenX, window.screenY + 16, window.innerWidth,window.innerHeight].join(',') );
}
function submitWindow(event) {
savePosition();
window.KeyboardMaestro.Submit( event );
}
function cancelWindow(event) {
savePosition();
window.KeyboardMaestro.Cancel( event );
}
</script>
any help would be greatly appreciated!
thx again for your cool macros!
Z