View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004101 | MMW v4 | Framework: Scripts/Extensions | public | 2007-12-07 12:39 | 2009-01-07 23:40 |
Reporter | peke | Assigned To | |||
Priority | urgent | Severity | major | Reproducibility | always |
Status | closed | Resolution | no change required | ||
Summary | 0004101: SDB.Objects not available in OnStartup | ||||
Description | When trying to use SDB.Objects in Sub OnStartup MM rises Runtime Error 424 Object required 'SDB.Objects' | ||||
Additional Information | Example Script Code: Sub OnStartup Dim MyWindow ind = SDB.UI.AddOptionSheet("test",Script.ScriptPath,"InitSheet","SaveSheet",0) MyWindow = ind 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 End Sub | ||||
Tags | No tags attached. | ||||
Fixed in build | |||||
|
This isn't a bug in MM, the script is incorrect. E.g. this works fine: Sub OnStartup Dim MyWindow ind = SDB.UI.AddOptionSheet("test",Script.ScriptPath,"InitSheet","SaveSheet",0) Set MyWindow = Nothing 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 End Sub |
|
That code you wrote do not save Option sheet to collection Set for Objects and that was the intention, but it looks that this is not available at all within MM, See this code: Sub OnStartup Dim MyWindow Set MyWindow = Nothing 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)... Else ind = SDB.UI.AddOptionSheet("test",Script.ScriptPath,"InitSheet","SaveSheet",0) MyWindow = ind Set SDB.Objects("MyWindowRef") = MyWindow ' ... add it to the collection End If End Sub |
|
No, as documented in Wiki, 'ind' is an integer and so it can't be stored as an Object, that's VB thing, not MM thing. |
|
I know that, thx for reminding me I Have found the workaround. Thing I wanted to archive is that I want save option sheet created in script1.vbs and then access it from Script2.vbs to create additional Sub Sheet using MediaMonkey.ini it could be archived by saving ind value in ini and then use it as ParentID for Script2 (eg. Last.fm services -> last.fm DJ (As services subsheet)? Something like this works: Script1.vbs: ind = SDB.UI.AddOptionSheet("test", SDB.ScriptsPath,"InitSheet","SaveSheet",0) SDB.IniFile.IntValue("Custom Option Sheets", "RootSheetID") = ind Script2.vbs: ind = SDB.UI.AddOptionSheet("test", SDB.ScriptsPath,"InitSheet","SaveSheet", SDB.IniFile.IntValue("Custom Option Sheets", "RootSheetID")) Closing the issue. |