Community Forum

Display Version

Profile Image 2 Posts 2 Karma
User77 posted this 02 August 2012

Is there a possibility to display ScriptX version? I thought of something like

Set Factory = CreateObject("ScriptX.Factory")

WScript.Echo "Installed Version of ScriptX"
If Err.Number = 0 Then
  WScript.Echo Factory.Version
Else
  WScript.Echo "ScriptX is not installed"
End If

or

<head>
<title>029 - MeadCo ScriptX Test</title>

<!-- MeadCo ScriptX -->
<object id="factory" viewastext style="display:none"
classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814">
</object>

<script defer>
function window.onload() {
  if ( !factory.object ) {
    document.all.text1.innerHTML = "MeadCo's ScriptX Control is not properly installed!";
    return;
  }
  document.all.text1.innerHTML = "Ready to script MeadCo's ScriptX!";
  document.all.text2.innerHTML = factory.version
}
</script>
</head>
<body>
<h2 id="text1">Text</h2><br />
<h2 id="text2">Text</h2>
</body>
</html>

Profile Image 189 Posts 189 Karma
Profile Image 2 Posts 2 Karma
User77 posted this 09 August 2012

Thank you. Unfortunately the PC is not connected to internet at this time (image build). Therefore I want to do it myself.

Unfortunately (2) in sample is not shown how it was done. Can you post it here, please?

Nevertheless I will use the sample page at a later time of the process.

Profile Image 189 Posts 189 Karma
Jerry posted this 09 August 2012

We'l be lucky if this shows up:

 

+++++++++++++++++++++++++++++

 

 

<

html>

 

<

head><title>

 

 

 

MeadCo's ScriptX :: Discover installed version

</

title>

 

<linkhref="/Content/Samples.css"rel="stylesheet"type="text/css"/>

 

<linkhref="/Content/noprint.css"rel="Stylesheet"type="text/css"media="print"/>

 

 

 

<scriptsrc="/Scripts/jquery-1.5.1.min.js"type="text/javascript"></script>

 

 

 

<scripttype="text/javascript">

 

// A simple wrapper object on the MeadCo ScriptX printing object, aka factory.printing

 

//

 

// Going forward, use MeadCo.ScriptX.Printing

 

//

 

var MeadCo = {

 

ScriptX: {

 

// Public interface

 

Printing:

null,

 

Utils:

null,

 

 

 

Init:

function() {

 

if ( this.Printing == null ) {

 

var f = document.getElementById("factory");

 

if ( f && f.object ) {

 

this.Utils = f.object;

 

this.Printing = f.printing;

 

}

 

}

 

returnthis.Printing != null;

 

},

 

InitWithVersion :

function(strVersion) {

 

var bok = false;

 

if ( this.Init() ) {

 

bok =

this.IsVersion(strVersion);

 

if ( !bok )

 

alert(

"ScriptX v" + strVersion + " or later is required.\nYou are using a previous version and errors may occur.");

 

}

 

return bok;

 

},

 

IsVersion:

function(strVersion) {

 

returnthis.IsComponentVersion("ScriptX.Factory", strVersion);

 

},

 

Version:

function() {

 

returnthis.GetComponentVersion("ScriptX.Factory");

 

},

 

 

 

PrintPage:

function(bPrompt) {

 

if (this.Init())

 

returnthis.Printing.Print(bPrompt);

 

returnfalse;

 

},

 

PreviewPage:

function() {

 

if (this.Init())

 

this.Printing.Preview();

 

},

 

PreviewFrame:

function(frame) {

 

if (this.Init())

 

this.Printing.Preview(typeof (frame) == "string" ? (this.IsVersion("6.5.439.30") ? frame : eval("window." + frame)) : frame);

 

},

 

 

 

PrintFrame:

function(frame, bPrompt) {

 

if (this.Init())

 

returnthis.Printing.Print(bPrompt, typeof (frame) == "string" ? (this.IsVersion("6.5.439.30") ? frame : eval("window." + frame)) : frame);

 

returnfalse;

 

},

 

PageSetup:

function() {

 

if (this.Init())

 

this.Printing.PageSetup();

 

},

 

PrintSetup:

function() {

 

if (this.Init())

 

this.Printing.PrintSetup();

 

},

 

HasOrientation:

function() {

 

returnthis.IsComponentVersion("ScriptX.Factory", "7.0.0.1");

 

},

 

// return an array of the names of the printers on the system

 

//

 

GetAvailablePrinters:

function() {

 

var plist = new Array();

 

var name;

 

if ( this.Init() ) {

 

try {

 

for (var i = 0; (name = this.Printing.EnumPrinters(i)).length > 0 ; i++ ) {

 

plist.push(name);

 

}

 

}

catch ( e ) {}

 

}

 

return plist;

 

},

 

 

 

GetComponentVersion:

function(sComponent) {

 

var a = new Object();

 

var b = new Object();

 

var c = new Object();

 

var d = new Object();

 

var s = "(Not installed)";

 

try {

 

document.getElementById(

"factory").GetComponentVersion(sComponent, a, b, c, d);

 

s = a[0] +

"." + b[0] + "." + c[0] + "." + d[0];

 

}

 

catch (e) {

 

}

 

return s;

 

},

 

IsComponentVersion:

function(strComponentName, strVersionRequired) {

 

returnthis._compareVersions(this.GetComponentVersion(strComponentName), strVersionRequired);

 

},

 

// Private implementation

 

// compareVersions

 

//

 

// Return true if v1 is later than or equal to v2

 

//

 

_compareVersions:

function(v1, v2) {

 

var a = v1.split(".");

 

var b = v2.split(".");

 

var i;

 

if (a.length != b.length)

 

returnfalse;

 

for (i = 0; i < a.length; i++) {

 

a[i] = parseInt(a[i]);

 

b[i] = parseInt(b[i]);

 

}

 

if (a[0] > b[0])

 

returntrue;

 

if (a[0] >= b[0] && a[1] > b[1])

 

returntrue;

 

if (a[0] >= b[0] && a[1] >= b[1] && a[2] > b[2])

 

returntrue;

 

if (a[0] >= b[0] && a[1] >= b[1] && a[2] >= b[2] && a[3] >= b[3])

 

returntrue;

 

returnfalse;

 

}

 

},

 

 

 

Licensing : {

 

LicMgr:

null,

 

Init:

function() {

 

if ( this.LicMgr == null ) {

 

var l = document.getElementById("secmgr");

 

if ( l && l.object )

 

this.LicMgr = l.object;

 

}

 

returnthis.LicMgr != null && typeof(this.LicMgr.result) != "undefined";

 

},

 

 

 

IsLicensed:

function() {

 

if ( this.Init() ) {

 

returnthis.LicMgr.result == 0 && this.LicMgr.validLicense;

 

}

 

returnfalse;

 

},

 

 

 

ReportError:

function(msg) {

 

 

 

if ( !this.IsLicensed() ) {

 

if ( this.LicMgr != null ) {

 

switch ( this.LicMgr.result ) {

 

case 0:

 

if ( !this.LicMgr.validLicense )

 

this._reportError(1,msg);

 

break;

 

case 1:

 

// magic value: this only applies if path param not

 

// not given - .result==1 => license not installed

 

this._reportError(2,msg);

 

break;

 

 

 

case -2147220500:

 

// magic value: this only applies if a path

 

// was given and the license is valid and was

 

// displayed to the user for acceptance -

 

// .result == -2147220500 => the user clicked cancel on the dialog

 

this._reportError(3,msg);

 

break;

 

// some other error, e.g. download failure - this will

 

// have already been displayed to the user in an error box.

 

// we could be here in the path given or not given cases if there

 

// was an error such as reading the registry, though such errors

 

// are unlikely.

 

default:

 

this._reportError(4,"License manager reported: (" + secmgr.result + ")",msg);

 

break;

 

}

 

}

 

else

 

this._reportError(0,msg);

 

}

 

},

 

 

 

_reportError:

function(eIndex) {

 

var msg = this._errorLicenseMsgs[eIndex];

 

 

 

for (var i=1; i<arguments.length; i++) {

 

if ( arguments[i] )

 

msg +=

"\n\n" + arguments[i];

 

}

 

alert(msg);

 

},

 

 

 

_errorLicenseMsgs :

new Array("Unable to locate the MeadCo License Manager object - the component is probably not installed.",

 

"The license for this site is not valid.",

 

"The license for this site not installed on this machine.",

 

"You did not accept the license for this application, it cannot be run.",

 

"There was an error loading the license. "

 

)

 

}

 

}

 

$(document).ready(

function() {

 

// alert("Master::Document ready");

 

if (!factory.object) {

 

// IE9 or later Filtering enabled?

 

if (typeof window.external.msActiveXFilteringEnabled != "undefined" && window.external.msActiveXFilteringEnabled() == true) {

 

$(

'#MeadCo_ScriptX_ActiveXFiltered').show();

 

$(

'#MeadCo_ScriptX_installFailure').hide();

 

}

 

else {

 

$(

'#MeadCo_ScriptX_ActiveXFiltered').hide();

 

$(

'#MeadCo_ScriptX_installFailure').show();

 

}

 

$(

'#sampleContent').hide();

 

}

else {

 

$(

'#MeadCo_ScriptX_ActiveXFiltered').hide();

 

$(

'#MeadCo_ScriptX_installFailure').hide();

 

$(

'#sampleContent').show();

 

}

 

 

 

// Specific to the MeadCo samples system

 

UpdateInstalledVersionInfo();

 

});

 

// UpdateInstalledVersionInfo

 

//

 

// Specific to the main samples listing page.

 

//

 

// Tell the server what version we have installed,

 

// and is we have an opener and it has a function by which it

 

// wants to be told, tell it.

 

//

 

function UpdateInstalledVersionInfo() {

 

$.post(

"/Home/UpdateInstalledVersion",{ version: MeadCo.ScriptX.GetComponentVersion("ScriptX.Factory"), sample: "InstalledVersion" });

 

 

 

if ( window.opener != null && typeof window.opener.UpdateInstalledVersion == "object" ) {

 

window.setTimeout(

"window.opener.UpdateInstalledVersion(true);",5000);

 

}

 

}

 

</script>

 

 

 

 

 

<scripttype="text/javascript">

 

$(document).ready(

function() {

 

$(

"#versioninfo").text(MeadCo.ScriptX.GetComponentVersion("ScriptX.Factory"));

 

$(

"#visecmgr").text(MeadCo.ScriptX.GetComponentVersion("MeadCo.SecMgr"));

 

$(

"#viprint").text(MeadCo.ScriptX.GetComponentVersion("MeadCo.Triprint"));

 

$(

"#closebutton").click(function() { window.close(); });

 

if (window.opener == null) {

 

$(

"#closecontroller").remove();

 

}

 

});

 

</script>

 

</

head>

 

<

body>

 

<

divid="bodycontent">

 

<divid="MeadCo_ScriptX_installFailure">

<

h2>It appears ScriptX is unavailable or has failed to install.</h2>

 

<

p><b>Has Internet Explorer notified you?</b></p>

 

<

p>Internet Explorer may have notified you of the attempt to install ScriptX and will ask your permission, the notification bar looks like this:</p>

 

<

pstyle="padding: 4px"><imgsrc="/Content/images/notificationbar.png"></p>

 

<

p>If the bar has appeared, click <i>Install</i> to install ScriptX.</p>

 

<

p><b>Are you an administrator?</b></p>

 

<

p>ScriptX is code that requires you have administrator rights on your machine in order to install it successfully.</p>

 

<

p>If you are not an administrator, please contact your administrator and ask them to install ScriptX for you.</p>

 

</div>

 

 

 

<divid="MeadCo_ScriptX_ActiveXFiltered">

 

<h2>It appears ScriptX is unavailable.</h2>

 

<p>Have you enabled IE 9 and later ActiveX Filtering? If you have, click the blue icon in the address bar and turn off ActiveX Filtering, it looks like this:</p>

 

<pstyle="padding: 4px"><imgsrc="/Content/images/activexfiltering.png"></p>

 

</div>

 

<divid="sampleContent">

 

 

 

<h2>MeadCo's ScriptX :: Discover installed version</h2>

 

<p>The installed version of ScriptX is: <spanid="versioninfo">Unknown</span></p>

 

<p>The installed version of Security Manager is: <spanid="visecmgr">Unknown</span></p>

 

<p>The installed version of Print component is: <spanid="viprint">Unknown</span></p>

 

<pid="closecontroller"><buttonid="closebutton">Close window</button></p>

 

 

 

 

 

</div>

</

div>

 

 

<!-- MeadCo ScriptX Factory Component -->

 

<!-- ********************************************************************************* -->

 

<!-- * DO NOT copy this codebase - it can change at any time * -->

 

<!-- * download the (free) ScriptX Resource Kit and store the cab on your own server * -->

 

<!-- ********************************************************************************* -->

 

<

objectstyle="width: 0; height: 0; visibility: hidden;"id="factory"classid="clsid:1663ED61-23EB-11D2-B92F-008048FDD814"viewastext>

 

</

object>

 

 

 

 

 

 

</

body>

 

</

html>

Profile Image 189 Posts 189 Karma
Jerry posted this 09 August 2012

OK, there you go, something for a bit of copy / paste / head scratching :-)

Post Edited 09 August 2012