>> << Ndx Usr Pri Phr Dic Rel Voc !: wd Help User

# Examples

Example: Graph control

File: examples\ocx\misc\graph.js has a simple example using Pinnacle's GRAPH32.OCX control.

For a fuller example:

    load 'examples\ocx\graph\grafdemo.js'

Example: TreeView
This example assumes you have the TreeView OCX installed and assorted bitmaps.

Run the script examples\ocx\misc\tree.js to create a treeview control. An imagelist control is loaded with various bitmaps which are then used by the treeview control.

Example: Controlling Microsoft Word
It is possible to automate the word.basic object. This could be a useful way of solving some printing problems. The following loads Word, and reads in the J readme.wri file:

    load 'examples\ocx\misc\word.js'

Example: Excel OLE Automation

    wd 'pc excel'
| parent to hold ole child
    wd 'cc x oleautomation:excel.application'
| create excel.application object
    wd 'oleset x base visible 1'
| set base visible property to 1
    wd 'oleget x workbooks'
| get workbooks object as temp
    wd 'oleid x workbooks'
| temp to permanent as workbooks
    wd 'olemethod x workbooks open foo.xls'
| open workbook foo.xls
    wd 'olemethod x workbooks add'
| run workbooks add method add method returns temp as the new workbook object
    wd 'oleget x temp name'
| get workbook name
    wd 'olemethod x base quit'
| quit

The excel.application object is defined in the system registry to create a new instance (private copy) of excel. The excel.sheet object creates a new worksheet in a shared excel.

Run the script and then run excel''. It is possible to access properties and methods directly, as well as run macros. The getobject verb shows how to support some of the simpler syntax of VB. Run excelquit'' to close excel.

>> << Ndx Usr Pri Phr Dic Rel Voc !: wd Help User