Reading the IniFile

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Reading the IniFile

Re: Reading the IniFile

by PetrCBR » Sun Jan 08, 2017 6:27 am

I've added complete list of settings into wiki

Re: Reading the IniFile

by crap_inhuman » Fri Jan 06, 2017 6:31 pm

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

by PetrCBR » Sun Jan 01, 2017 12:56 pm

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

by crap_inhuman » Sun Jan 01, 2017 10:19 am

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

by PetrCBR » Sat Dec 31, 2016 6:47 am

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

by crap_inhuman » Fri Dec 30, 2016 10:17 pm

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

by crap_inhuman » Tue Dec 27, 2016 10:54 am

Thank you for the workaround!

Re: Reading the IniFile

by PetrCBR » Tue Dec 27, 2016 6:43 am

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

by crap_inhuman » Mon Dec 26, 2016 8:39 pm

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

by Peke » Mon Dec 26, 2016 8:12 pm

Are you referring to tools that can devs use in order to read/write MediaMonkey.INI?

Re: Reading the IniFile

by crap_inhuman » Mon Dec 26, 2016 7:52 pm

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

by jiri » Mon Dec 26, 2016 3:52 pm

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

Reading the IniFile

by crap_inhuman » Mon Dec 26, 2016 6:06 am

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

Top