Version 7 of optcl

Updated 2002-02-01 21:36:51

"Open Tcl is a Tcl extension to provide connectivity to the resident hosts component model." http://www.sys.uea.ac.uk/~fuzz/optcl/default.html Farzad Pezeshkpour wrote and maintains it.


[Recommend Leslie Brooks' nice example [L1 ] and commentary ...]


An example:

    #
    # Open Word and read the template for the report.  (The template
    # contains Header and Footer macros that we will use.)
    #
    set word [optcl::new word.application]
    set filename [file join [pwd] "Chapter 5 template.doc"]
    set doc [$word -with documents open $filename]
    #
    # Set the header by running a Word Macro recorded in the
    # template file and passing it the parameters it needs 
    # (System Release, RTP version, and Test Step).
    #
    $word run header "$test_step" "$SR" "$RTP_Version"
    $word run footer "$Operator"    

The template for the header macro is

    Sub Header(TestStep As String, SR As String, RTP As String)
    '
    ' Header Macro
    ' Macro recorded 7/24/01 by Leslie Brooks
    ' Set the Test Step number, the System Release number, and the
    ' RTP version number in the report header.

    .


    .

    . 
    End Sub  

Michael Jacobson: Here is some code to display a Microsoft's Internet Explorer ActiveX component in a Tk frame with the IE's scroll bar.

 package require optcl
 wm title . {MSIE in Tk with scroll}
 set htm [optcl::new -window .htm {{8856F961-340A-11D0-A96B-00C04FD705A2}}]
 .htm config -width 800 -height 600
 pack .htm -fill both -expand 1
 $htm navigate www.scriptics.com
 # to view the type information for the control
 pack [button .b  -text "View TypeLibrary for IE container" -command {
                        tlview::viewtype [ optcl::class $htm ]
        } ] -side bottom

Here is the code to do it without the IE's scroll bar. Notice the difference???

 package require optcl
 wm title . {MSIE in Tk without scroll}
 set htm [optcl::new -window .htm {http://www.scriptics.com}]
 .htm config -width 800 -height 600
 pack .htm -fill both -expand 1
 # to view the type information for the control
 pack [button .b  -text "View TypeLibrary for IE container" -command {
                        tlview::viewtype [ optcl::class $htm ]
        } ] -side bottom

Michael Jacobson: A little bigger example is how to play a VCD with Microsoft's MediaPlayer using optcl.

 package require optcl
 wm title . {VCD Document in Tk}
 set vcd [optcl::new -start -window .vcd {{22D6F312-B0F6-11D0-94AB-0080C74C7E95}} ]
 .vcd config -width 640 -height 480
 pack .vcd -fill both -expand 1
 # put location of VCD file here ... need to make much smarter
 $vcd : filename "E:/mpegav/music01.dat"
 $vcd Play
 # view the loaded activex component
 ## tlview::loadedlibs .tmp2
 #how long the file is
 ## clock format [expr int([clock scan 0]+ [$vcd : duration])] -format %T
 # current position in time
 ## clock format [expr int([clock scan 0]+ [$vcd : CurrentPosition])] -format %T