- window.find()
- window.findList()
- window.getParent()
- window.getTitle()
- window.setTitle()
- window.getClassName()
- window.valid()
- window.getRect()
- window.setRect()
- window.getClientRect()
- window.setClientRect()
- window.show()
- window.flash()
- window.getPixel()
- window.pixelSearch()
- window.saveScreenshot()
- window.getAppHwnd()
- window.getFocusHwnd()
- window.makeColor()
- window.drawLine()
- window.drawRect()
Finds a window's HWND (handle to window) based on its title (not case-sensitive), and (optionally) its classname (case-sensitive). 'title' and 'classname' can contain wildcards * and ?.
The ? wildcard allows for one of any character and the * wildcard allows any number of any character.
Returns the first match found. If no match was found, returns
Exactly like window.find() except that it returns a
Returns a
Returns a window's parent, or
Returns a window's title as a string.
Returns a window's title as a
Change a window's title.
Returns a window's class name as a
Returns
Returns the position (x,y), size (w,h), and 'showCmd' (integer describing the show state) of a window.
See window.show() for details on 'showCmd'.
Change the position and size of a window with handle 'hwnd'.
Exactly like window.getRect() except it returns only the client area.
The "client area" refers to the area of the window without borders or title bars.
Change the position and size of a window's client area with handle 'hwnd'.
The "client area" refers to the area of the window without borders or title bars.
Show/hide/minimize/maximize/whatever with the window.
For 'cmd', you should specify one of the following constants:
"Flash" the window to attempt to grab the user's attention. If 'flashCount' is < 0, stop flashing. If 'flashCount' is 0, flash until user focuses the window. If 'flashCount' is > 0, flash this many times and then stop.
When a window is "flashed", this will cause the icon/window to flash a highlighted color on your Windows taskbar before remaining highlighted. This only affects the item in the taskbar, and not the window itself. Once the window has gained focus (ie. clicked on), the flashing/highlight will be removed.
Window flashing must be turned on (default) for this to work. The setting may be modified in Windows 11's Taskbar Personalization under the "Taskbar behaviors" section.
Get the color of a pixel at (x,y) inside window 'hwnd', and return the color split into red, green, and blue channels. 'r', 'g', and 'b' results will be between 0 and 255.
For example: 0,0,0 is black, 255,255,255 is white, and 255,0,255 is "Magic" pink.
Search the given window for a pixel that matches r,g,b within the rectangle outlined by (x1,y1) -> (x2,y2). The rect may go from left-to-right, right-to-left, top-to-bottom, bottom-to-top, or any combination of those, depending on the orientation of the two points.
'accuracy' is how many units each channel must be within the given color to generate a match. ie. with an accuracy of 20, the red, green, and blue channels must be within 20 of the target color to match. Default: 1
'step' is the step size (distance between pixels to search). You generally have no need for this so long as you aren't scanning a large area, but you may experience faster scan times (with a chance of missing a match) with a higher step size. Default: 1
Returns the first matching pixel's coordinates (x,y). If the pixel is not found, this function
returns
Save a screenshot of window 'hwnd' to 'filename'. If 'hwnd' is 0, this screenshots the whole desktop.
NOTE: You cannot take a screenshot of a minimized window. This is a limitation in Windows.
Returns the calling process' (MicroMacro) handle to window (HWND). This is what you may use to access or modify the console's properties where an hwnd is required.
Returns the hwnd of whichever window is top-most as of the the start of this logic cycle.
This is polled once per frame and should be fairly accurate so long as your script executes each
logic cycle quickly. Be aware that as windows are being minimized, maximized, or otherwise, the
focused hwnd may temporarily switch to
This helper function converts red-green-blue components into a long integer color value for use in other functions. All input values (red, green, and blue) should be integers between 0 and 255. (0, 0, 0) would result in black, (255, 255, 255) would result in white and (0, 255, 0) would result in green.
Draws a line in the client region of the window specified by hwnd (note: use 0 to draw directly to screen). It is possible to draw outside of the given window with this function. A line will be drawn starting from (x1,y1) to (x2,y2) with the given color and line thickness. By default, color will be black (0, 0, 0) and thickness (in pixels) will be 1.
You should use window.makeColor() to generate the number passed as the color value if you wish to specify a color by RGB. Alternatively, you can pass the value in by hex notation (ie, 0xFF00FF).
Returns
Note: windows redraw themselves (or parts of themselves) regularly. This may be triggered from an event (something changed in this program - so update the display) or happen at regular intervals (games aim to refresh the screen at 60+ frames per second). If the window is redrawn, whatever you have drawn to that window will likely be painted over. You may opt to continually paint to the window to combat this, however that is likely going to result in some flickering. This is unavoidable without hooking the target application; a topic best left for another time. As such, it is recommended that you only use these types of drawing functions during the design process or during debugging, otherwise your project might look a little bit amateurish.
This functions exactly like window.drawLine(), except that it draws a rectangle rather than a line.
Returns
Page last updated at 2023-10-25 13:45:33