Copy link to clipboard
Copied
Still new to Captivate 2019 and have a project's table of contents open another project (named module_01). When the learner is finished with module_01, I would like them to be able to return to the table of contents in module_00, which is slide 2. The projects are not being run on an LMS. The projects will be published as both swf and HTML5.
Previous posts in the forum are a few years old and many refer to a link to "captivatedev.com". Unfortunately, this domain is no longer active. There was, according to forum messages, a link in 2011 on "how to jump to a specific slide in a separate course".
That is what I wish Captivate 2019 to do ... go from module_00, slide 2 to module_01, and have a button/action to return to module_00, slide 2.
Advice/comments?
Thank you.
Copy link to clipboard
Copied
If you were only exporting to HTML5, you could add a query string to the URL. An example:
www.google.com?startSlide=88
The ?startSlide=88 is the query string.
You could have some Javascript on the first slide to check to see if there is a query string and then jump to whatever number is sent in query string.
Here is a tutorial on how to read the query string:
https://html-online.com/articles/get-url-parameters-javascript/
I do not know if it is possible with .swf output. I don't see any actions for reading the query string and I dont know if Javascript will work in the .sfw output, I kind of doubt it.
Copy link to clipboard
Copied
Thank you for the feedback.
I have a first module (module00.cptx) which contains the Objectives on Slide 2. I have a second module (module 01) which has a "Return to Objectives" button with the following settings:
On Success: Open URL or File
URL: module_00.cptx?slide=2
in the current window (I prefer not to have accumulating windows being opened).
Do I put the JavaScript in the first module, on the first slide?
On Enter: Execute JavaScript
in the current window
I am not sure if posting of JavaScript is allowed in the forums. I did find Jim Leichliter's JavaScript (from 2011).
Also, do I have to put the module(s) in the 'callees' subdirectory of module_00?
Thank you once again.
Copy link to clipboard
Copied
Your URL won't be opening a CPTX file for the end user. A CPTX file is the Captivate project file, not the published output.
Copy link to clipboard
Copied
Thank you for pointing my error. I have published the modules (main module and sub-modules) individually. I can 'jump' to the first slide of the sub-modules (the action's button Opens another project, Project: module_01). I can not return to the main module.
1.) what should I enter in the On Success: Open URL or file? I have all the modules in a subdirectory on my workstation. Each module's subdirectory consists of:
index.html
project.txt
goodbye.html
and the following subdirectories:
ar
assets
callees
dr
vr
would I use (without the quotes) "module_00\index.html?slide=2" in the URL of the 'open URL or file' ?
2) do I include the sub-module's files (those published with the files and sub folders shown above) in the callees folder for each of main module?
Copy link to clipboard
Copied
All of the files need to be present in their respective subfolders under the folder for that module. Your Open URL or File action needs to point to the index.html file. That's the file that will open the module in the way it should.
However, the folder structure you describe here is for HTML5 output. You mentioned above that the content will be published for both HTML5 and SWF. You need to realise that SWF is an entirely different animal and the published output is not going to have the same file structure. Additionally, the JavaScript code that works for HTML5 output will need to be recoded in order to work for SWF.
I would recommend you ditch the SWF anyway because Flash will end next year or so.
Copy link to clipboard
Copied
I republished (HTML5) the sub-modules after changing the actions...on success, as shown in the below graphic, as I wish to go to slide 2 of module_00.
Is the query string of ?slide=2 acceptable, or should it be, as mentioned in earlier post, ?startSlide=2?
After the sub-modules were published, I copied the published subdirectories to module_00 'callees' folder.
When I use my browser and select module_00 index.html, and navigate through this module to the Course Map, I click on the sub_module's map item and am brought to the sub_module. This part works fine.
When I click on the Return to Course Map button, using the above graphic's On Success, I receive "This page can't be displayed" in my browser.
There is JavaScript for slide 1 of module_00, on Enter: Execute JavaScript. I am using the JavaScript originally provided by Mr. Jim Leichliter in the forums.
All modules were published as HTML5. Working with one publishing format at a time, HTML5 being foremost; and yes, with SWF end of life at the end of 2020, I have opted to concentrate on HTML5.
Thoughts/Comments/Suggestions?
In advance, thank you.
Copy link to clipboard
Copied
You might need to post the actual code you are currently using before the JS experts on this forum would be able to see what might be the issue.
Copy link to clipboard
Copied
Thank you Rod for the suggestion,
This is the JS I found from Jim Leichliter's post. I have it on the first slide of module_00:
On Enter: Execute JavaScript.
Script_Window: Current
Continue Playing the Project is selected (checked)
On Exit: No Action.
I am using Captivate 2019 release, v11.0.266, and it is 'up to date'.
GetSlideParam();
function GetSlideParam(){
if(window.location.href.indexOf('?slide=') != -1) {
var startIndex = window.location.href.indexOf('?slide=' ) + 7;
var URL = window.location.href.toString();
var slideNumber = URL.substring(startIndex);
if(slideNumber != '' || slideNumber != null){
setTimeout(function(){NavigateToSlide(slideNumber);}, 200);
}
}
}
function NavigateToSlide(requestedSlide){
var cpObj = document.Captivate;
cpObj.cpEISetValue('cpCmndGotoSlide',requestedSlide - 1);
cpObj.cpEISetValue('rdcmndResume',1);
}
Copy link to clipboard
Copied
Use this JS:
if ( window.location.href.indexOf("?slide=") !== -1 )
{
var getParam = window.location.href.split("?");
var startIndex = getParam[1].split("=");
window.cpAPIInterface.setVariableValue("cpCmndGotoSlide",Number(startIndex[1])-1);
}
Copy link to clipboard
Copied
Thank you for the JS.
I put the JS in module_00.
Actions, On Enter: Execute JavaScript
Using Current Window
Continue Playing the Project is selected (checked)
On Exit: No Action.
The project was saved, and published, and when executing the index.html, when clicking the Return to Course Map button,from another module (module_01), I still receiving the message "This page can't be displayed".
Copy link to clipboard
Copied
Your path to the file is not correct then.
It may be better to open the other file with JavaScript. Can you show how the folders/files are structured?
Copy link to clipboard
Copied
Thank you for the response.
The Actions button for On Success: Open URL or file, URL: module_00\index.html?slide=2.
The file structure, showing the callees, is:
Copy link to clipboard
Copied
Execute this JS:
window.open("../../index.html?slide=2","","","_self");
Copy link to clipboard
Copied
I replaced the JS in module_00 with the above one-line.
When I go to the index.html, I receive an error indicating could not find "Documents/index.html?slide=2". I selected OK.
When I continue and select module_01, and select Return to Course Map, again, the file cannot be displayed.
All the published files are being executed from the "troubleshooting" subdirectory.
Copy link to clipboard
Copied
That code does not go in module_00, it goes in all of the other modules to get back to module_00.
Maybe I'm confused
Copy link to clipboard
Copied
In the file structure graphic I posted, the Troubleshooting directory is a subdirectory of C:\My Documents. So from C:, module_00 index.html is three levels down (My Documents, troubleshooting, and module_00). The callees subdirectory is four levels down.
When the projects are published, they will be put on a DVD to be accessed by a web browser. I envision the DVD root to have module_00 and all other modules will be in the callees folder.
Where in module_01 would I put the JS?
Copy link to clipboard
Copied
Where ever you were using the Go to URL or file action. Is it attached to a button?
Copy link to clipboard
Copied
There is a button with Actions, On Success: Open URL or File. It has Infinite Attempts.
The URL is: module_00\index.html?slide=2
This is set to open in 'current'.
Copy link to clipboard
Copied
That's where you put this JavaScript instead. You said it wasn't opening the file correct? I don't think it will let you build relative links:
window.open("../../index.html?slide=2","","","_self");
Copy link to clipboard
Copied
I have put the one-line JS in the "Return" button's actions in module_01.
On Success:
Execute JavaScript
Current Window
It does now return to module_00, however it is opening in a new window/browser tab, and it displays the Project Start screen (with the 'play' button, and now a 'gestures' button.)
Major objective to return to module_00 is successful.
Two other issues: it did not return to the particular slide (slide 2) and now the Project Start screen has a 'gestures' button showing.
Thank you.
Copy link to clipboard
Copied
Eliminated the 'gestures' button ... deselected More ... Mobile Gestures ... Gesture Configuration, so 'Mobile Gestures is No, and republished the project.
However, even having the button, On Success Execute JavaScript, current window, it does return to module_00 in a new window/browser tab, and displays the Project Start screen.