B
Bandaar
Hello,
I have a difficult task I believe. I have tcl code that opens a
webpage, then via execScript commands calls javascript code to play
audio files for my js object player. The problem is that I need to know
when the clip is done for example to have my tcl code check for that.
Has anyone been able to pass a javascript variable to tcl code, or has
had a work around to this??
Here is what I have so far:
tcl code (I am using optcl to open the page in a tk window):
# set tk window
package require optcl
set t [toplevel .ie]
wm title $t "my Test"
set htm [optcl::new -window $t.htm Shell.Explorer.2]
$t.htm config -width 800 -height 600
pack $t.htm -fill both -expand 1
# Open the page
$htm navigate "c:/test/v1fe.htm"
#### This is not the right way to get the variable
# A test to see if I can get a variable from javascript, it doesnt work
cause execScript passes null
set myVar [[$htm -with Document : parentWindow] execScript
{javascript:myfunction ()}]
puts $myVar
my javascript code:
<script type="text/javascript">
<!--
// Test to pass value 1 to tcl code
function myfunction()
{
return(1)
}
//-->
</script>
Any suggestions/examples??
Thanks,
Bandaar
I have a difficult task I believe. I have tcl code that opens a
webpage, then via execScript commands calls javascript code to play
audio files for my js object player. The problem is that I need to know
when the clip is done for example to have my tcl code check for that.
Has anyone been able to pass a javascript variable to tcl code, or has
had a work around to this??
Here is what I have so far:
tcl code (I am using optcl to open the page in a tk window):
# set tk window
package require optcl
set t [toplevel .ie]
wm title $t "my Test"
set htm [optcl::new -window $t.htm Shell.Explorer.2]
$t.htm config -width 800 -height 600
pack $t.htm -fill both -expand 1
# Open the page
$htm navigate "c:/test/v1fe.htm"
#### This is not the right way to get the variable
# A test to see if I can get a variable from javascript, it doesnt work
cause execScript passes null
set myVar [[$htm -with Document : parentWindow] execScript
{javascript:myfunction ()}]
puts $myVar
my javascript code:
<script type="text/javascript">
<!--
// Test to pass value 1 to tcl code
function myfunction()
{
return(1)
}
//-->
</script>
Any suggestions/examples??
Thanks,
Bandaar