Simulates mouse clicking and clipboard access within WSH
There is no support for mouse clicking and setting/getting clipboard from within Microsoft Windows Scripting Host (WSH), at least in March 2007. So we provide a COM component "Toas" to provide such features.
Toas is provided in both of free and licensed versions. In the free version, a message box is displayed when Toas is loaded, and the number of method calls is limited to 20 times. When the number of method calls exceeds the limitation, DISP_E_UNKNOWNINTERFACE is returned. The licensed version does not have these limitations.
The following example code shows how to use Toas in WSH (JScript).
var tos = WScript.CreateObject( "TamaSoft.OA.Server" ); // Create Toas object tos.click(); // Click at the current position var txt = tos.getClipboard(); // Assign the current clipboard content to txt WScript.echo( txt ); // Display it
File name | toas.dll |
---|---|
OLE server name | TamaSoft.OA.Server |
Method | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Clipboard | |||||||||||
getClipboard() | Returns the clipboard content
| ||||||||||
setClipboard( txt ) | Set the clipboard content
| ||||||||||
Mouse | |||||||||||
click( hwnd ) | Simulates mouse clicking at the current position
| ||||||||||
dblClick( hwnd ) | Simulates mouse double-clicking at the current position
| ||||||||||
setMousePos( x, y ) | Moves the mouse cursor to the specified screen coordinate
| ||||||||||
moveMouse( x, y ) | Moves the mouse cursor relatively by specified pixels
| ||||||||||
getMousePosX() | Returns the horizontal mouse cursor position
| ||||||||||
getMousePosY() | Returns the vertical mouse cursor position
| ||||||||||
getMouseCursor() | Returns the handle of the current mouse cursor
| ||||||||||
getSystemCursor( idc ) | Returns the mouse cursor handle provided by the Windows system
| ||||||||||
Window | |||||||||||
getForegroundWindow() | Returns the current foreground window (Equivalent to Windows API function GetForegroundWindow())
| ||||||||||
setForegroundWindow( hwnd ) | Sets the current foreground window
| ||||||||||
getActiveWindow() | Returns the current active window (Equivalent to Windows API function GetForegroundWindow())
| ||||||||||
setActiveWindow( hwnd ) | Sets the current active window
| ||||||||||
getWindowPosX( hwnd ) | Returns the horizontal position of a window
| ||||||||||
getWindowPosY( hwnd ) | Returns the vertical position of a window
| ||||||||||
setWindowPos( hwnd, x, y ) | Sets the position of a window
| ||||||||||
getWindowSizeX( hwnd ) | Returns the horizontal size of a window
| ||||||||||
getWindowSizeY( hwnd ) | Returns the vertical size of a window
| ||||||||||
setWindowSize( hwnd, x, y ) | Sets the size of a window
| ||||||||||
getWindowText( hwnd ) | Returns the text of a window
| ||||||||||
windowFromPoint( x, y ) | Returns the window at the specified position
| ||||||||||
topWindowFromPoint( x, y ) | Returns the top-level window at the specified position
| ||||||||||
Others | |||||||||||
beep() | Beeps shortly. | ||||||||||
beep( helz, msec ) | Beeps in specified frequency for specified time
| ||||||||||
version() | Returns the Toas version
|
Click the right link to download Toas ⇒ ToasSetup.exe
You can use Toas freely if you accept that a message box is displayed each time when Toas.dll is loaded, and the number of method calls is limited to 20 times.
If you want to distribute Toas for commercial purpose or put it in a commercial product, or if you want to suppress this message box, you are required to pay for user registration. After the user registration, the limitation is removed.
For more details on how to register, click here.
Tama Software Ltd. info@tamasoft.co.jp
Toward Senju Bldg. 1-801, 3-6 Senju, Adachi-ku, Tokyo, Japan 120-0034