Page 1 of 1
Reading the IniFile
Posted: Mon Dec 26, 2016 6:06 am
by crap_inhuman
The com-object SDB.IniFile isn't available in the Beta MM5. Will this be included in the final Version of MM5? If not, how can i read from Mediamonkey.ini?
Greetings
Sven
Re: Reading the IniFile
Posted: Mon Dec 26, 2016 3:52 pm
by jiri
Could you clarify the exact user-case, please? We don't plan to port all of the COM, but will try to help with everything that makes sense.
Thanks,
Jiri
Re: Reading the IniFile
Posted: Mon Dec 26, 2016 7:52 pm
by crap_inhuman
Hi Jiri,
i need the following settings from the ini-file:
"PreviewSettings" -> "DefaultCoverStorage"
"AAMasks" -> "Mask1"
"CustomFields" -> "Fld1Name"
"CustomFields" -> "Fld2Name"
"CustomFields" -> "Fld3Name"
"CustomFields" -> "Fld4Name"
"CustomFields" -> "Fld5Name"
"Appearance" -> "MultiStringSeparator"
It would be great if i can read this settings.
Thank you!
Greetings,
Sven
Re: Reading the IniFile
Posted: Mon Dec 26, 2016 8:12 pm
by Peke
Are you referring to tools that can devs use in order to read/write MediaMonkey.INI?
Re: Reading the IniFile
Posted: Mon Dec 26, 2016 8:39 pm
by crap_inhuman
I implemented my own read/write function in the script to store the user settings.
So it would be helpful for me if i can use a COM which give me the path to the mediamonkey.ini (like SDB.TemporaryFolder)
With the path i can use my func to read the settings i need.
Re: Reading the IniFile
Posted: Tue Dec 27, 2016 6:43 am
by PetrCBR
As a workaround for now ...
We have API for accessing INI from JS:
Code: Select all
var sett = JSON.parse(app.settings.getJSON(''));
var Custom1 = sett.CustomFields.Fld1Name;
In COM model we have SDB.runJSCode method to run JS code and return values you're required.
Re: Reading the IniFile
Posted: Tue Dec 27, 2016 10:54 am
by crap_inhuman
Thank you for the workaround!
Re: Reading the IniFile
Posted: Fri Dec 30, 2016 10:17 pm
by crap_inhuman
PetrCBR wrote:As a workaround for now ...
We have API for accessing INI from JS:
Code: Select all
var sett = JSON.parse(app.settings.getJSON(''));
var Custom1 = sett.CustomFields.Fld1Name;
In COM model we have SDB.runJSCode method to run JS code and return values you're required.
How did i get the var Custom1 back to the COM model?
I tested it with this vbscript. The test with window.alert show me the name of the Customfield1, so it works, but i need the name in the ret variable.
Code: Select all
Set SDB = CreateObject("SongsDB5.SDBApplication")
Code = "var sett = JSON.parse(app.settings.getJSON(''));" & vbCrLf
Code = Code & "var Custom1 = sett.CustomFields.Fld1Name;" & vbCrLf
Code = Code & "window.alert(Custom1);"
ret = SDB.runJSCode(Code, True)
MsgBox(ret)
Thanks for your help.
Re: Reading the IniFile
Posted: Sat Dec 31, 2016 6:47 am
by PetrCBR
Simply use return
for example:
Code: Select all
Set SDB = CreateObject("SongsDB5.SDBApplication")
Code = "(function () { var sett = JSON.parse(app.settings.getJSON(''));" & vbCrLf
Code = Code & "var Custom1 = sett.CustomFields.Fld1Name;" & vbCrLf
Code = Code & "return Custom1; })()"
ret = SDB.runJSCode(Code, True)
MsgBox(ret)
Re: Reading the IniFile
Posted: Sun Jan 01, 2017 10:19 am
by crap_inhuman
Happy new year to you and the MM-Team.
Sorry, but it doesn't work for all settings:
I try to fetch these 3 settings
Code: Select all
Set SDB = CreateObject("SongsDB5.SDBApplication")
SDB.ShutdownAfterDisconnect = False
Code = "(function () { var sett = JSON.parse(app.settings.getJSON(''));" & vbCrLf
'Code = Code & "var ret = sett.PreviewSettings.DefaultCoverStorage;" & vbCrLf
'Code = Code & "var ret = sett.Appearance.MultiStringSeparator;" & vbCrLf
Code = Code & "var ret = sett.AAMasks.Mask1;" & vbCrLf
Code = Code & "return ret; })()"
ret = SDB.runJSCode(Code, True)
MsgBox(ret)
Trying to fetch the setting: PreviewSettings.DefaultCoverStorage returns nothing
Trying to fetch the setting: AAMasks.Mask1 returns an Application Error
Trying to fetch the setting: MultiStringSeparator return the correct value
Re: Reading the IniFile
Posted: Sun Jan 01, 2017 12:56 pm
by PetrCBR
Best would be to add
var sett = JSON.parse(app.settings.getJSON(''));
into JS script and using a devtools check what values you can access.
Re: Reading the IniFile
Posted: Fri Jan 06, 2017 6:31 pm
by crap_inhuman
PetrCBR wrote:Best would be to add
var sett = JSON.parse(app.settings.getJSON(''));
into JS script and using a devtools check what values you can access.
I don't know, what i have to do. Could you please this more explain?
Re: Reading the IniFile
Posted: Sun Jan 08, 2017 6:27 am
by PetrCBR
I've added complete list of settings into
wiki