Copy link to clipboard
Copied
Hi,
I've been trying to affect the output of cpInfoPercentage to appear on a certificate without anything after the decimal point (e.g. 67 instead of 67.66666666). I have also tried to limit the amount of charaters in the caption box (but I can't even specify that anywhere!) to help. Is there a solution out there?
Regards
AcademicMonkey
Copy link to clipboard
Copied
Same problem here, compounded by the fact that I have an odd number of questions (13), and different questions have different weight (from 5 to 15 points, totalling 145 points), which makes any result lower than 100% a very long number with many decimals.
Copy link to clipboard
Copied
Hi
This is a problem I'm also encountering with cpInfoPercentage - even after editing the variable's maximum number of characters from 15 to 3 ie to represent 0 - 100% scoring ranges I'm still getting a pass perecentage with a ridiculous amount of digits ie 26.14568978235%
Any suggestions would be welcome
Mike
PS I even tried adding a text box with % in it and a blank rectangle to mask the extra digits but this didn't work...
Copy link to clipboard
Copied
The solution:
1. Create a custom variable.
2. on the sldie where you want to use the precentage, execute the following javascript on entry:
document.myCaptivate.cpEISetValue('MyPercentage', Math.round((document.myCaptivate.cpEIGetValue('cpInfoPercentage'))));
myCaptivate (both instances) is the id of your swf object on your HTML page. Try "Captivate" if using the default html page.
MyPercentage is the custom variable you created and is what you now access to get the percentage score.
Andrew
Copy link to clipboard
Copied
Thank you Andrew!
Copy link to clipboard
Copied
No problem.
Copy link to clipboard
Copied
I don't know Captivate 4, but in 5 one of the slide properties is "On Entry". One of the availiable options is Execute Javascript. Select that, then click "script window" and put your Javascript in there.
note: You have to publish the project and view it in a browser for it to work.
Copy link to clipboard
Copied
Hi Andrew,
Thanks for the quick reply. The Note you gave was really useful and I didnt know it b4. Finally I found the place where i have to write the javascript.
So my variable is "varPer". but it dont assign the "cpInfoPercentage" value for the "varPer". its not showing any value. my jave script is -
document.myCaptivate.cpEISetValue('varPer', Math.round((document.myCaptivate.cpEIGetValue('cpInfoPercentage'))));
some screen shots hear for you to understand my problem.
Thanks
Hasith
Copy link to clipboard
Copied
Looks fine to me.
Try running it in Google Chrome and open the console to see what Javascript errors you get.
Make sure you have followed this line of my instructions:
myCaptivate (both instances) is the id of your swf object on your HTML page. Try "Captivate" if using the default html page.
and this one:
note: You have to publish the project and view it in a browser for it to work.
Copy link to clipboard
Copied
Hi Andrew,
"myCaptivate (both instances) is the id of your swf object on your HTML page. Try "Captivate" if using the default html page."
I used here "Captivate" for myCaptivate. its still not giving the answer.
I think the problem is in"id of swf object".
how to find the id of swf object on HTML page.?
Thanks,
Hasith
Copy link to clipboard
Copied
Paste the full html code of your page here and I'll tell you.
Copy link to clipboard
Copied
<!-- Copyright [2008] Adobe Systems Incorporated. All rights reserved -->
<!-- saved from url=(0013)about:internet -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Quiz 1T</title>
<script src="standard.js" type="text/javascript"></script>
</head>
<body bgcolor="#F1F4F5">
<center>
<div id="CaptivateContent">
</div>
<script type="text/javascript">
var so = new SWFObject("capD4F6.swf", "Captivate", "960", "751", "8", "#CCCCCC");
so.addParam("quality", "high");
so.addParam("name", "Captivate");
so.addParam("id", "Captivate");
so.addParam("wmode", "window");
so.addParam("bgcolor","#F1F4F5");
so.addParam("menu", "false");
so.addVariable("variable1", "value1");
so.setAttribute("redirectUrl", "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash");
so.write("CaptivateContent");
</script>
<script type="text/javascript">
document.getElementById('Captivate').focus();
document.Captivate.focus();
</script>
</center>
</body>
</html>
Copy link to clipboard
Copied
I can't see what is wrong. Sorry.
From the above, I would say that the swf id is "Captivate".
I suggest re-reading this thread carefully, checking your code carefully and seeing what javascript errors are generated in the Google Chrome console.
Copy link to clipboard
Copied
Thanks Andrew.
Copy link to clipboard
Copied
I am trying to learn this wonderful stuff...but I cannot get to the screen you show above to write the script...The only option I have is the Advanced Actions tab under Project. Help!
Copy link to clipboard
Copied
That screen was for Captivate 4. In Captivate 5 the UI for advanced actions has changed. For the first two statements you have to use the statement Assign. For the 3 last ones with the calculations you'll need Expression.
Lilybiri
Copy link to clipboard
Copied
If you have found a fix, I will pay you to remote in to my computer and just do it for me! I'm that desperate.
Copy link to clipboard
Copied
Do you want me to translate that advanced action? And the way to create an advanced action: perhaps this video tutorial I created a while ago (it is for an advanced action in CP5.0) could help you see the work flow:
Create customized feedback with advanced actions
I do not know where you live. It is possible to meet in my Connect meeting room online if you cannot figure it out after the video tutorial. You'll have to send me a private message with your e-mail address to invite you.
Lilybiri
Copy link to clipboard
Copied
I will certainly check it out. It is frustrating to have gaps which I don’t know how to fill. So, thanks for the help!
Dabareh
Copy link to clipboard
Copied
The link doesn’t seem to work. I did a search, but couldn’t find it, either.
Dabareh
Copy link to clipboard
Copied
Sorry about the link, should have checked.
Trying again: Create customized feedback with advanced actions
And here is a list with all the articles I published about advanced actions:
https://acrobat.com/#d=tGgSjfVqRtEgI6fORG-zbw
On my blog you'll find more tutorials and examples:
Lilybiri
Copy link to clipboard
Copied
Hi Andrew,
In the mean time I found another way to do this. But plz send me the "id of swf object on HTML page", I can learn from it.
what I did is wrote a saparete function to calculate the percentage and use different variables to track the exact decimal places I need.
hear is the code,
Its worked exactly for one decimal place. (eg :-66.6)
Thank You very much for your help and time.
Hasith