how we use tcom to control vi program? we have got this tcl script from googling but it is not running , it says to run the vi as activex server ,how can we do it? it is opening the vi but gives the error "high frequency not found in vi connector pane.what are the different methods that we can use with vi ? in the example some methods such as getvireference etc have been used
#
# Interfacing to LabView via TCOM
#
package require tcom
#
# Start the "Frequency Response" VI as an ActiveX server. (If the VI
#was
# compiled then you would refer to it by its registered server name.
#For
# example, if you compiled 'A.vi' and created 'A.exe', then you would
#load
# it with 'set lv [::tcom::ref createobject "A.Application"]'.)
#
set lv [::tcom::ref createobject "LabView.Application"]
#
# Create a reference to the VI. (You may want to use
# '[$lv ApplicationDirectory]' to get the correct path for this PC.
# For a compiled VI, use just the VI's name, for example:
# 'set viPath "A.vi"'.)
#
set viPath "C:\\Program Files\\National Instruments\\LabVIEW 8.2\\examples\\apps\\freqresp.llb\\Frequency Response.vi"
set vi [$lv GetVIReference $viPath]
$vi FPWinOpen True
#
# Create the parameter arrays. The first array is a list of terminal
#names;
# the second array is a list of their values. We must pass in a value
#for
# every terminal on the VI's connector (unless we are very sure that
#the VI
# has a valid initial value for that terminal). We must also pass in
#a
# value for the output terminals; LabView will ignore it.
#
set names [list Amplitude "Number of Steps" "Low Frequency" "High
Frequency" "Response Graph"]
#
# Create the values array
#
set values [list 5 105 15 1005 0]
#
# Call the VI and get the results
#
$vi Call names values
#
# The Response Graph is returned in 'values'
#
puts $values
#5 105 15 1005 {{400.0 406.238291234 412.573873162...
#
# If the VI is running we cannot use the 'Call' method, but we can
# set and query individual Controls/Indicators. (The "Frequency
# Response" VI does not continue running - you call it, it runs, then
# it stops until you call it again. However, many VIs run
#continuously
# once you start them, and many are set to start running as soon as
#you
# load them. Obviously, compiled VIs typically start running as soon
# as you load them.)
#
$vi SetControlValue "Low Frequency" 5
$vi SetControlValue "Amplitude" 10
$vi GetControlValue "Amplitude"
# 10
#
# The graph hasn't changed (because the VI isn't running), but we can
# still read it. Notice that the graph is an Indicator (not a
#Control),
# but we still use the 'GetControlValue' method to read it.
#
set new_graph [$vi GetControlValue "Response Graph"]
#
# You may need to manipulate the VI's menus. Unfortunately LabView
#does
# not expose any method for doing this, so you must use the Windows
# Scripting Shell. The <ESC> key does not seem to work this way, so
# the menus should have shortcuts that use ALT or Ctrl key
#combinations.
#
# Start the Windows Scripting Shell and send an <ALT> key to the GUI
#
set WShell [::tcom::ref createobject WScript.Shell]
$WShell SendKeys %%
$WShell SendKeys {DOWN}
#
# Send Alt-X
#
$WShell SendKeys %X
#
# When we are done, we may want to shut down the VI.
#
$lv Quit