ISDBApplication::Objects: Difference between revisions

From MediaMonkey Wiki
Jump to navigation Jump to search
No edit summary
 
m (Corrected the example code for VBScript)
Line 8: Line 8:
===Property description===
===Property description===


A collection for a temporary storage of any type of COM object during MediaMonkey running time. For example if a window is created by script that should remain visible while the script isn't running, the window object can be put to this collection in order to keep a reference to it.
A collection for temporary storage of any type of object during MediaMonkey running time. For example if a window is created by script that should remain visible while the script isn't running, the window object can be put into this collection in order to keep a reference to it. The keys of this collection are strings, the values are objects.


===Example code===                     
===Example code===                     
<source lang="vb">If SDB.Objects[ 'Store'] Is Nothing Then    ' If the object isn't in collection yet...
<source lang="vb">If SDB.Objects("MyWindowRef") Is Nothing Then    ' If the object isn't in collection yet...
   SDB.Objects[ 'Store'] = MyWindow         ' ... add it to the collection...
   Set SDB.Objects("MyWindowRef") = MyWindow     ' ... add it to the collection (using Set for objects)...
EndIf
End If


SDB.Objects[ 'Store'] = Nothing               '  ... and now again remove it from the collection.</source>
' Some code here
 
SDB.Objects("MyWindowRef") = Nothing             '  ... and now remove it from the collection.</source>


[[Category:Scripting|{{PAGENAME}}]]
[[Category:Scripting|{{PAGENAME}}]]

Revision as of 19:01, 7 May 2007

CoClass SDBApplication, Interface ISDBApplication

Property Get/Let Objects(Name As String) As Object


Parameters

Name Type Description
Name String An identifier for object storage.


Property description

A collection for temporary storage of any type of object during MediaMonkey running time. For example if a window is created by script that should remain visible while the script isn't running, the window object can be put into this collection in order to keep a reference to it. The keys of this collection are strings, the values are objects.

Example code

If SDB.Objects("MyWindowRef") Is Nothing Then    ' If the object isn't in collection yet...
  Set SDB.Objects("MyWindowRef") = MyWindow      ' ... add it to the collection (using Set for objects)...
End If

' Some code here

SDB.Objects("MyWindowRef") = Nothing             '  ... and now remove it from the collection.