Saturday, January 12, 2008

Captivate SCORM template causes a VBScript Error in any ASP based LMS

By default Adobe Captivate 3.0 SCORM packages won't run as ASP pages. You can see this in IIS by changing the .htm file to .asp in your SCORM package. This should result in an error:


Microsoft VBScript runtime error '800a01a8'

A serious consequence of this is that Captivate generated SCORM packages cannot be embedded inside ASP pages. This means that Captivate packages won't run in LMSs that are developed with ASP (Pathlore, anyone?).

Fortunately, it is straightforward to analyze and fix the problem, at least in the simplest .htm -> .asp setting.

Adobe Captivate uses a version of the popular Macromedia SCORM template. It contains this browser selection code:


// Hook for Internet Explorer
if ((navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) || g_intAPIType == -1)
{
g_intAPIType = 0;
document.write('<script language="\">\n');
document.write('On Error Resume Next\n');
document.write('Sub Captivate_FSCommand(ByVal command, ByVal args)\n');
document.write('Call Captivate_DoFSCommand(command, args)\n');
document.write('End Sub\n');
document.write('</script\>\n');
}
else
{
g_intAPIType = 1;
}


Inside the selection code is VBScript generated by JavaScript. This is a no-no in classic ASP.

The "fix" is to simply run the VBScript outside the browser selection code.

<SCRIPT LANGUAGE=VBScript>
On Error Resume Next
Sub Captivate_FSCommand(ByVal command, ByVal args)
Call Captivate_DoFSCommand(command, args)
End sub
</SCRIPT>