Japanese


COM Component for WSH
Toas V1.04


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.

Usage Example

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

COM Component Information

File name toas.dll
OLE server name TamaSoft.OA.Server

Methods

MethodDescription
Clipboard
getClipboard() Returns the clipboard content
<return value> (string)
Text content of the clipboard
setClipboard( txt ) Set the clipboard content
txt (string)
Content to be set
Mouse
click( hwnd ) Simulates mouse clicking at the current position
hwnd (integer)
Handle of the target window. Optional. When omitted or equal to zero, the window under the current mouse cursor position is targeted
dblClick( hwnd ) Simulates mouse double-clicking at the current position
hwnd (integer)
Handle of the target window. Optional. When omitted or equal to zero, the window under the current mouse cursor position is targeted
setMousePos( x, y ) Moves the mouse cursor to the specified screen coordinate
x (integer)
Horizontal screen coordinate of destination
y (integer)
Vertical screen coordinate of destination
moveMouse( x, y ) Moves the mouse cursor relatively by specified pixels
x (integer)
Horizontal pixel number to move (positive=right, negative=left)
y (integer)
Vertical pixel number to move (positive=down, negative=up)
getMousePosX() Returns the horizontal mouse cursor position
<return value> (integer)
Screen coordinate
getMousePosY() Returns the vertical mouse cursor position
<return value> (integer)
Screen coordinate
getMouseCursor() Returns the handle of the current mouse cursor
<return value> (integer)
Mouse cursor handle
getSystemCursor( idc ) Returns the mouse cursor handle provided by the Windows system
idc (integer)
A numeric value indicating the type of cursor. It can be any identifier (IDC_???) passed to the Windows API function LoadCursor(). Here are typical values:
32512Standard arrow (IDC_ARROW)
32513I-beam (IDC_IBEAM)
32514Hourglass (IDC_WAIT)
32650Standard arrow and small hourglass (IDC_APPSTARTING)
32651Arrow and question mark (IDC_HELP)
Comparing the return values from this method and getMouseCursor() method to check the type of the current mouse cursor, you may be able to detect whether an application is busy or not.
<return value> (integer)
Mouse cursor handle
Window
getForegroundWindow() Returns the current foreground window (Equivalent to Windows API function GetForegroundWindow())
<return value> (integer)
Window handle
setForegroundWindow( hwnd ) Sets the current foreground window
hwnd (integer)
Window handle
getActiveWindow() Returns the current active window (Equivalent to Windows API function GetForegroundWindow())
<return value> (integer)
Window handle
setActiveWindow( hwnd ) Sets the current active window
hwnd (integer)
Window handle
getWindowPosX( hwnd ) Returns the horizontal position of a window
hwnd (integer)
Window handle
<return value> (integer)
Horizontal screen coordinate of the upper-left corner of the window
getWindowPosY( hwnd ) Returns the vertical position of a window
hwnd (integer)
Window handle
<return value> (integer)
Vertical screen coordinate of the upper-left corner of the window
setWindowPos( hwnd, x, y ) Sets the position of a window
hwnd (integer)
Window handle
x (integer)
Horizontal screen coordinate of the upper-left corner of the window
y (integer)
Vertical screen coordinate of the upper-left corner of the window
getWindowSizeX( hwnd ) Returns the horizontal size of a window
hwnd (integer)
Window handle
<return value> (integer)
Horizontal size
getWindowSizeY( hwnd ) Returns the vertical size of a window
hwnd (integer)
Window handle
<return value> (integer)
Vertical size
setWindowSize( hwnd, x, y ) Sets the size of a window
hwnd (integer)
Window handle
x (integer)
Horizontal size
y (integer)
Vertical size
getWindowText( hwnd ) Returns the text of a window
hwnd (integer)
Window handle
<return value> (string)
Window's title or control's text
windowFromPoint( x, y ) Returns the window at the specified position
x (integer)
Horizontal size
y (integer)
Vertical size
<return value> (integer)
Window handle
topWindowFromPoint( x, y ) Returns the top-level window at the specified position
x (integer)
Horizontal size
y (integer)
Vertical size
<return value> (integer)
Window handle
Others
beep() Beeps shortly.
beep( helz, msec ) Beeps in specified frequency for specified time
helz (integer)
Frequency
msec (integer)
Time (msec)
version() Returns the Toas version
<return value> (string)
Toas's version

Download

Click the right link to download Toas   ⇒   ToasSetup.exe

How to Install

  1. Run the downloaded "ToasSetup.exe" file.
  2. When you installed to other folder than the default "C:\Program Files\TamaSoft\Toas" (or "C:\Program Files (x86)\TamaSoft\Toas" in 64-bit environment), open "Toas-Install.reg" (or "Toas-Install-64.reg" in 64-bit environment) file located in the installation folder using a text editor such as Notepad, then change "C:\Program Files\TamaSoft\Toas\Toas.dll" to "<installation folder>\Toas.dll" in the 3rd line.
  3. Double click the "Toas-Install.reg" (or "Toas-Install-64.reg" in 64-bit environment) file, or right click it and select Merge.
  4. A message indicating "Are you sure you want to add the information in …" is displayed, then click Yes. A message is displayed indication "Information in … has been successfully entered into the registry (when using Windows XP).

How to Uninstall

  1. Double click the Toas-Uninstall.reg (or "Toas-Uninstall-64.reg" in 64-bit environment) file in the installation folder, or right click it and select Merge.
  2. A message indicating "Are you sure you want to add the information in …" is displayed, then click Yes. A message is displayed indication "Information in … has been successfully entered into the registry (when using Windows XP). Although the message is "entered", actually Toas related information has been deleted from the registry.

User Registration

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.

Revision History

V1.0   2007/03/16
The first version
V1.01   2007/03/20
Fix a problem that topWindowFromPoint() behaves like windowFromPoint()
V1.02   2007/03/20
Supported getMouseCursor() and getSystemCursor()
V1.03   2007/03/27
Provided the English edition
V1.031   2008/03/27
Changed the functional limitation of the free version
V1.032   2008/07/08
Modified the processing of the license file
V1.04   2008/09/03
Resolved the problem that getClipboard() and setClipboard() cannot handle Chinese text in English Windows environment.
V1.04   2017/02/19
Add .reg files for 64 bit environment

Developed and Provided by

Tama Software Ltd.   info@tamasoft.co.jp

Toward Senju Bldg. 1-801, 3-6 Senju, Adachi-ku, Tokyo, Japan 120-0034