When using Custom HTML Prompt you can set the window size and position in two ways according to the docs:
data-kmwindowattribute on the body element
The problem is that I have not been able to get,
window.KeyboardMaestro.ResizeWindow() to set the size or position. If you use a button to do it, it works, but just calling the function from your script will do nothing.
I think this is a bug.
See related post: In KM10, is window.KeyboardMaestro.ResizeWindow() broken in Custom HTML Prompts? by Dan Thomas
My workaround is simple. Setting the size/position with the
data-kmwindow attribute on the body element works. So, I just set that attribute with JS:
// Desired location and/or size as string let windowTarget = "100,100,500,400" let body = document.querySelector('body') body.setAttribute('data-kmwindow', windowTarget)
The good things are that this will happen when the window is opened, and can be set programmatically using variables from KM.