Using OKScript's Mouse Capabilities

Few Windows applications fail to include the ability to navigate their user interface with the keyboard, but when one of these is encountered they often prove resistant to automation. OKScript's mouse instructions can simplify this task by providing another way to select controls in the application. Here is an example that uses this technique to send messages to the e-bridge client. It could easily be adapted to the Yahoo bridge client or other applications.

PROC ebchat
  WINDOW e-bridge
  MOUSE WINXYLOW 354 215
  MOUSE LEFTCLICK
  PUT %-args%{enter}

PROC ebalert
  WINDOW e-bridge
  MOUSE XY 432 394
  MOUSE LEFTCLICK
  PUT %-args%
BUTTON welcome blue *ebchat #Welcome all, good luck
BUTTON ...
BUTTON ...
The upper section in blue is a PROCedure that is included once at the top of your code and is used by each message BUTTON in your script. It activates the e-bridge window, moves the mouse to the chat bar, clicks and types in a message. The coordinates for the MOUSE movement instructions may have to be changed depending on your video resolution, see table - these work for 1152x864. (OKScript has a built-in mouse position tool to easily determine key coordinates.) A better target for alert messages than the chat bar may be the special alert text area in the bid box. This could be implemented with another PROC (in gray) with different coordinates.

e-bridge chat bar and alert control coordinates (note that chat uses
MOUSE WINXYLOW, alert uses MOUSE XY)
Screen
Resolution
Chat
(WinXYLow)
Alert
(Screen-XY)
800x600 158, 84 254, 263
1024x768 273, 170 370, 350
1152x864 354, 215 432, 394
1280x1024 418, 294 500, 475

The BUTTON instructions that follow the PROC declaration replace the familiar window-name and message fields with calls to this PROCedure. Once this PROC is written for a particular application adding message BUTTONs to a script requires no further specialized code with each generally requiring only one instruction line.