TIP: Custom HTML Prompt to Display Text Large

How can I pass the window position, height and width, along with the font size via KM variables to the script?

Hi @mikewolf1127,

For passing window height and width, please refer to the post below:

To be more specific, I use a function to resize the window:

	function resizeWindow() {
		// get the front screen coordinates: top-lef.X, top-left.Y, bottom-right.X, bottom-right.Y
		let screenCoordinatesArr = window.KeyboardMaestro.ProcessTokens( '%Screen%Front%' ).split(",");
		
		let winSize = window.KeyboardMaestro.GetVariable( 'instanceWindowSize' );
		let winWidth = "";
		let winHeight = "";
		
		
		if (winSize != "") {
			let winSizeArr = winSize.split(",");
			winWidth = parseInt(winSizeArr[0]);
			winHeight = parseInt(winSizeArr[1]);
		} else {
			winWidth = 540;  // Default window width; change the value as you need.
			winHeight = 300; // Default window height; change the initial value as you need.
		}
				
		// the winX below will set the HTML window to the upper-right color of the front window.
		let winX = parseInt(screenCoordinatesArr[0]) + parseInt(screenCoordinatesArr[2]) - winWidth;
		let winY = 19; // 19 is the height of the menu bar.

		window.KeyboardMaestro.ResizeWindow(winX + "," + winY + "," + winWidth + "," + winHeight);
	}

If the following action is activated, then it will use the number set by you, otherwise, the window size is by default as set in the html code.
image

This gives you some idea how things are handled by javascript functions.

For font size, you can use a javascript function to change it too. You may refer to posts such as

The difference in Keyboard Maestro is that you need to get the KM variable value. This is demonstrated in the code above, such as:

let winSize = window.KeyboardMaestro.GetVariable( 'instanceWindowSize' );