Skip to main content
Inspiring
September 2, 2015
Answered

Where would I drop a script in an html if I wanted it to communicate with CPTV8

  • September 2, 2015
  • 1 reply
  • 584 views

Hi,

I am trying to make some simple variable changer html files that I can drag and drop into captivate.

I want them to call to captivates cpInfo and cpCmnd Systems variables. Iknow the scripts work as I can get them to work in captivates own script window.

I just need them to operate from a web object.

My html code is this.

//////////////////////////////////////////////////

<html>

<head>

<script>

window.onload = function() {

window.cpAPIInterface.next();

};

</script>

</head>

<body>

</body>

</html>

/////////////////////////////////////////////////////

I thought this would work but nothing happens.

Any help would be appreciated.

Cheers

Luke

This topic has been closed for replies.
Correct answer Bustergoof

And again oops the above code is incorrect. It was working fine because the code was still sitting in the captivate script window.

I still need help with this.


OK I cracked it!

It helps for captivate to have a receiver script. Something like this:

    function Tell_me(string)

{

  window.cpAPIInterface.setVariableValue("Questions",string);

    }

and the html file has a sender script. Like this:

<html>

<head>

<script type="text/javascript">

    parent.Tell_me('The quick brown fox');

</script>

</head>

<body>

</body>

</html>

The data gets sent from one to the other. I think I can do heaps with this from here on.

1 reply

Inspiring
September 2, 2015

Hey I figured this out on my own.

//////////////////////////////////////////////////

<html>

<head>

<script>

window.onload = window.cpAPIInterface.next();

</script>

</head>

<body>

</body>

</html>

/////////////////////////////////////////////////////

Inspiring
September 2, 2015

Oops I have a new problem now....

Cptv8 is loading from a cached version of the file I loaded. Its an older html file not the one I want to load.

Is there no end to how rubbish this software is?

Lilybiri
Legend
September 2, 2015

OK I cracked it!

It helps for captivate to have a receiver script. Something like this:

    function Tell_me(string)

{

  window.cpAPIInterface.setVariableValue("Questions",string);

    }

and the html file has a sender script. Like this:

<html>

<head>

<script type="text/javascript">

    parent.Tell_me('The quick brown fox');

</script>

</head>

<body>

</body>

</html>

The data gets sent from one to the other. I think I can do heaps with this from here on.


Totally off topic, thanks a lot for this workaround but do you mind if I move this thread to the subspace 'Advanced'? You don't want to frighten newbies