-
1. Re: How to pass arguments into a Captivate project
Russ_E Sep 29, 2014 7:31 AM (in response to Pkoel)There are a few ways to do it, both automated and manual.
I am assuming you are outputting as html5 here.
But this is a simple manual way.
1.
create a variable in cp to hold your value. (e.g. holdName)
2.
add js to the page (after you export it)
//check if window.cpAPIInterface is available and ready
if(window.cpAPIInterface)
{
//assign your value to the cp variable you created in the project
window.cpAPIInterface.setVariableValue("holdName",whatevervalueyouarepassing);
}
Hope that makes sense and helps.
Russ
-
2. Re: How to pass arguments into a Captivate project
Pkoel Sep 29, 2014 9:57 AM (in response to Russ_E)Hi Russ,
Thanks for the fast response. I added the following code to the
index.html page of my published project:
if(window.cpAPIInterface)
{
window.cpAPIInterface.setVariableValue("holdName",
);
}
</script>
Where is the DNN token I want to pass to the Captivate
project. The syntax for the token I got from a DNN website.
I also tried putting a quoted string in place of the token just to see if
it would pass something; and it was a no-go. Any ideas?
Thanks,
Peter
-
3. Re: How to pass arguments into a Captivate project
Russ_E Sep 29, 2014 12:31 PM (in response to Pkoel)Sorry. I think I was a bit too vague in my answer.
And I don't know about how you are getting your token value, but that part is up to you.
Just make sure to put it in place of where I wrote "whateveryourtokenvalueiscalled".
1.
create a variable in cp to hold your value. (e.g. holdName)
2.
Add this inside the <head></head> tags of your page (after you export it):
<script>
function = getMyValues () {
if(window.cpAPIInterface)
{
//assign your token value to the cp variable you created in the project
window.cpAPIInterface.setVariableValue("holdName",whateveryourtokenvalueiscalled);
}
}
</script>
3.
Back in your cp project, call to the function at some point.
For example, on page 2, add to the page's action
On Enter:
Execute Javascript
Then in the script window, type this to start up the function:
getMyValues();
I hope that makes sense. I'm not really great at explaining scripting unfortunately.

