元編程參考文件

桌面自動化

預覽

滑鼠、鍵盤與已開啟視窗的操控

Methodox Wiki 上的使用指南

6 個類別,共 116 個節點

所屬發行版
元編程(教育版)元編程(專業版)
支援等級
第 2 級(擬定)
所屬包
桌面自動化
桌面自動化

控制滑鼠和鍵盤,與已開啟的視窗互動,並處理檔案和正在執行的程序。使用這些工具在其他桌面應用程式中自動執行任務。

巨集自動化

啟用視窗Brings the window whose title contains this text, ignoring case, to the front and gives it the keyboard - how a macro switches to another program before sending it keys.點選滑鼠Presses and releases a mouse button where the pointer already is.在指定位置點選滑鼠Moves the pointer somewhere and clicks there.關閉視窗Asks a window to close, as its title bar button does.指揮程序的視窗Applies one command to every window of a named process.按兩下滑鼠Presses and releases a button twice where the pointer already is.拖動Presses a button at one point, glides to another, and releases.沿路徑拖動Presses a button at the first point, glides through every remaining point in order, and releases at the last.沿多條路徑拖動Draws a whole pen path: one drag per pen-down..pen-up mark, in order, with the pen lifted between them.查詢視窗The first window whose title contains this text, or DesktopWindow.None.按程序查詢視窗Every window whose owning process has this name, ignoring case and an .exe suffix.按標題查詢視窗Every window whose title contains this text, ignoring case.聚焦程序Brings a named process's first window to the front.聚焦視窗Brings a window to the front and gives it the keyboard.能否讀取按鍵狀態Whether this machine can be asked what the keyboard is doing, as opposed to only told.是否支援False where nothing here can emulate input on this machine; every call is then a no-op.平臺名稱A short name for a status line: "Windows", "X11", "Quartz", "none".支援情況How far the backend in force is to be trusted.取得游標位置Where the pointer is now.取得指定位置的顯示器Which monitor a coordinate is on, or the primary one where it is on none of them.取得顯示器Every monitor, with its place on the virtual desktop and its scale.取得前臺視窗The window with focus, or DesktopWindow.None where nothing has it.取得自身程序名稱This process's own name, so a macro can recognise - and avoid acting on - the windows of the program running it.取得有視窗的程序The distinct names of every process that owns a window, for a caller offering a list to choose from.取得虛擬桌面邊界The rectangle every coordinate in this class lives in: the union of every monitor.取得視窗邊界Where the first window of a named process is, as four numbers, and whether it was found at all.取得視窗Every top-level window that is on screen and has a title, front-most first where the platform has an order.取得游標下的視窗The front-most window whose bounds contain the pointer, or DesktopWindow.None.按鍵是否按下Whether a key is physically down right now, whoever has focus.最大化前臺視窗Maximises the window that currently has focus.最大化程序視窗Maximises every window of a named process.最大化視窗Fills the window's monitor with it.最小化前臺視窗Iconifies the window that currently has focus.最小化程序視窗Iconifies every window of a named process.最小化視窗Iconifies a window.移動游標Moves the pointer by a delta from wherever it is.平滑移動游標Moves the pointer to an absolute coordinate over time, accelerating and decelerating.按鍵Presses and releases a key, optionally holding modifiers while it is pressed.按組合鍵Presses a chord given as keys: every key but the last is held, the last is pressed, and the held ones are released in reverse.還原程序視窗Brings back every minimised window of a named process, each as it was before it was minimised, and leaves its other windows as they are.還原視窗Puts a minimised or maximised window back to its previous size.滾動到位置Scrolls vertically.水平滾動Scrolls horizontally.傳送文字Types text into whatever has focus, as characters rather than key positions.設定游標位置Puts the pointer at an absolute virtual-desktop coordinate, immediately.設定按鍵狀態Holds a key down, or lets it up, without the other half.設定滑鼠狀態Presses or releases a mouse button without releasing it again.嘗試啟用按顯示器 DPI 感知Asks Windows to treat this process as per-monitor DPI aware, so the coordinates here are real pixels.嘗試按下指定名稱的鍵Presses a key named as text, including a chord written as one string: "Enter", "esc", "ctrl+c".嘗試按下指定名稱的多個鍵Presses a chord named as separate strings, as ["ctrl", "shift", "n"].等待Waits, in milliseconds.等待,除非按下某鍵Waits, unless a key goes down first - in which case it stops waiting there and says so.

螢幕矩形

桌面視窗

顯示器資訊

螢幕座標點

系統外殼