I'm having difficulty creating versions of my "AAA.Widget" component.
How does one go about creating versions of AAA.Widget ?
my .wsc files are below.
e.g. here is my test script.
----------------------------------------
t.wsf -----------------------------------------
<Job id="Test">
<script language="JScript" />
<script language="JSCript">
WScript.Echo("Start");
try {
oWidget1 = new ActiveXObject("AAA.Widget.1");
}
catch (oError) {
WScript.Echo("Failed to create AAA.Widget.1");
}
try {
oWidget2 = new ActiveXObject("AAA.Widget.2");
}
catch (oError) {
WScript.Echo("Failed to create AAA.Widget.2");
}
WScript.Echo("Finished");
</Script>
</Job>
-----------------------------------
widget1.wsc ---------------------------------------------------
<?xml version="1.0"?>
<component>
<?component error="true" debug="true"?>
<registration
description="AAA Widget 1 Description"
progid="AAA.Widget"
version="1"
classid="{867c8a54-8f8c-4372-addd-fad05ed0c264}"
>
</registration>
<public>
<property name="ID">
<get/>
<put/>
</property>
<method name="Version">
</method>
</public>
<script language="JScript">
<![CDATA[
var description = new Widget;
function Widget()
{
this.get_ID = get_ID;
this.put_ID = put_ID;
this.Version = Version;
}
var ID = "WidgetID";
function get_ID()
{
return ID;
}
function put_ID(newValue)
{
ID = newValue;
}
function Version()
{
return "Temporary Value";
}
]]>
</script>
</component>
-----------------------------------
widget2.wsc ---------------------------------------------------
<?xml version="1.0"?>
<component>
<?component error="true" debug="true"?>
<registration
description="AAA Widget 2 Description"
progid="AAA.Widget"
version="2"
classid="{35d2827e-db50-43c7-a24f-9be24bae750d}"
>
</registration>
<public>
<property name="ID">
<get/>
<put/>
</property>
<method name="Version">
</method>
</public>
<script language="JScript">
<![CDATA[
var description = new Widget;
function Widget()
{
this.get_ID = get_ID;
this.put_ID = put_ID;
this.Version = Version;
}
var ID = "WidgetID";
function get_ID()
{
return ID;
}
function put_ID(newValue)
{
ID = newValue;
}
function Version()
{
return "Temporary Value";
}
]]>
</script>
</component>
I really believe it's a Windows Scripting Component registration *bug*.
"Jon" <z...@hotmail.com> wrote in message
news:OGzmNQSQBHA.1524@tkmsftngp05...
progid="foo.bar"
version="x"
does create 2 progids that map to the same clsid
foo.bar and foo.bar.x
progid="foo.bar"
version="x.y"
creates 2 progids that map to the same clsid
foo.bar and foo.bar.x.y
And I can create an instance using any of the registered progids...
--
Michael Harris
Microsoft.MVP.Scripting
--
mik...@mvps.org
Please do not email questions - post them to the newsgroup instead.
--
"Jon Morgan" <mor...@mincom.com> wrote in message news:OE76rViRBHA.1528@tkmsftngp05...
"Michael Harris (MVP)" <mik...@mvps.org> wrote in message
news:O1pkWNqRBHA.1444@tkmsftngp03...
Registration was via the Explorer context menu command "Register" (created by the Windows Script installation) which maps to:
"C:\WINNT\System32\REGSVR32.EXE" /i:"%1" "C:\WINNT\System32\scrobj.dll"
===foo.wsc===
<component>
<?component debug="true"?>
<registration
description="foo component"
progid="foo.wsc"
version="1"
classid="{4d8fd870-6533-11d3-a591-0010e37c63c8}"
>
</registration>
<public>
<method name="test">
<parameter name="arg"/>
</method>
</public>
<script language="vbscript">
function test(arg)
test = ucase(arg)
end function
</script>
</component>
--
Michael Harris
Microsoft.MVP.Scripting
--
mik...@mvps.org
Please do not email questions - post them to the newsgroup instead.
--
"Jon Morgan" <mor...@mincom.com> wrote in message news:eqrwpdhSBHA.2004@tkmsftngp04...
foo1.wsc should contain the registration : ProgID=foo.wsc Version=1
foo199.wsc should contain the registration : ProgID=foo.wsc Version=1.99
Now once the above two wsc files are registered, they should both appear in
the OLE/COM Object Viewer tool at the same time.
The Widget1.wsc and Widget2.wsc files that i posted earlier should do this?
We wrote a Visual C equivalent of the Widget example and they both appeared
in the OLE/COM Object Viewer tool as expected,
i.e. AAA.Widget.1 and AAA.Widget.2
Regardless of being a C program or .wsc it should work the same, unless I'm
completely wrong about how ProgID's and the Versioning is supposed to work
??
"Michael Harris (MVP)" <mik...@mvps.org> wrote in message
news:u$yWwGoSBHA.2076@tkmsftngp03...
Given the way the progid/version values are used when registering WSCs, this is never going to work. You simply can't have 2 different WSCs that share the same non-version specific progid, not to mention the common classid...
--
Michael Harris
Microsoft.MVP.Scripting
--
mik...@mvps.org
Please do not email questions - post them to the newsgroup instead.
--
"Jon" <z...@hotmail.com> wrote in message news:e$zM$8xSBHA.1472@tkmsftngp05...
Why? is this a limitation or a bug ?
> not to mention the common classid...
No, the ClassIds are different in the Widget example I posted.
> You simply can't have 2 different WSCs that share the same non-version
specific progid.
See below..
The following two .rgs files allow two different versions of
"VerDemo.Abcde",
which live in seperate dlls and have different clsids.
VerDemo.Abcde.1
VerDemo.Abcde.2
HKCR
{
VerDemo.Abcde.1 = s 'Abcde Class'
{
CLSID = s '{98739448-E5AC-404C-851C-08909FB36775}'
}
VerDemo.Abcde = s 'Abcde Class'
{
CLSID = s '{98739448-E5AC-404C-851C-08909FB36775}'
CurVer = s 'VerDemo.Abcde.1'
}
NoRemove CLSID
{
ForceRemove {98739448-E5AC-404C-851C-08909FB36775} = s 'Abcde Class'
{
ProgID = s 'VerDemo.Abcde.1'
VersionIndependentProgID = s 'VerDemo.Abcde'
ForceRemove 'Programmable'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Apartment'
}
'TypeLib' = s '{F22E4D36-9F97-4245-B6CC-730900A35792}'
}
}
}
HKCR
{
VerDemo.Abcde.2 = s 'Abcde Class'
{
CLSID = s '{0A627588-B26E-4CD7-8512-9CE7B3978FF1}'
}
VerDemo.Abcde = s 'Abcde Class'
{
CLSID = s '{0A627588-B26E-4CD7-8512-9CE7B3978FF1}'
CurVer = s 'VerDemo.Abcde.2'
}
NoRemove CLSID
{
ForceRemove {0A627588-B26E-4CD7-8512-9CE7B3978FF1} = s 'Abcde Class'
{
ProgID = s 'VerDemo.Abcde.2'
VersionIndependentProgID = s 'VerDemo.Abcde'
ForceRemove 'Programmable'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Apartment'
}
'TypeLib' = s '{33D70177-CF4E-41E3-90AA-92703F46A34D}'
}
}
}
"Michael Harris (MVP)" <mik...@mvps.org> wrote in message
news:uGdefB2SBHA.1924@tkmsftngp07...
Note that the version attribute is optional. I suggest that you use progid attribute values that explicitly incorporate the version directly (e.g., foo.wsc.1 / foo.wsc.1.99 / etc.) each with a new classid for each. In effect all you are doing here is creating independent WSCs that only superficially share a common progid naming scheme and common functionality, but *not* a shared generic progid.