Problems regarding default properties and scripting languages 
Author Message
 Problems regarding default properties and scripting languages

Hi,

As part of my project, a subsystem allows for execution of scripts. This
subsystem contains a number of COM objects whose only function is to be
visible in the script and provide a link back to the main system.

I'm using Microsoft's Script Control to execute the script code.

In my script I have an object called Project. This is globally available
through a variable named project.

The Project object has a property named "Purposes". This returns a reference
to a collection object. The Collection is named "Purposes" and it contains
"Purpose" objects.

The "Purposes" collection object has 3 methods (property get!)
 interface IPurposes: IDispatch
 [
  object,
  uuid(08440261-DA09-45A0-B35F-AFC157C83FFC),
  dual,
  helpstring("IPurposes Interface"),
  pointer_default(unique),
  nonextensible
 ]
 {
  [propget, id(DISPID_NEWENUM)] HRESULT _NewEnum([out, retval] IUnknown**
pEnumVariant);
  [propget, id(DISPID_VALUE)] HRESULT Item([in] VARIANT Index, [out, retval]
VARIANT* pVal);
  [propget, id(1)] HRESULT Count([out, retval] long* pnCount);
 };

My problem is that in my scrip code, the followin works
set Purposes = Project.Purposes
set Purpose = Purposes(0)

but this doesn't:
set Purpose = Project.Purposes(0)
Here I get the error message: Object not a collection: 'Project.Purposes'

I would guess that the script parser would see that I was requesting the
default property of the object returned by the Purposes property on the
Project object. But it apparently doesn't.
Why?

Thanks in advance,
Peter Str?iman



Sun, 27 Feb 2005 20:39:03 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. questions regarding property sheet and property page

2. scripting language lua and C-functions

3. Simple Script Language question

4. Preprocessor Tricks -Scripting Language

5. C scripting language compiler

6. Virtual Machines & Scripting Languages

7. Need help with porting a Scripting Language

8. Scripting language library

9. ANN: Scripting language for Windows

10. PERL Scripting language

11. Playing sound files from within a DOS scripting language

12. Best language for cgi scripts?

 

 
Powered by phpBB® Forum Software