5,598,718 Members 38,626 Now Online
XDA Developers Android and Mobile Development Forum

[MortScript] iniEditor: get a friendly menu out of an .ini file!

Tip us?
 
michoob
Old
(Last edited by michoob; 18th April 2011 at 09:18 PM.) Reason: iniEditor v05
#1  
michoob's Avatar
Recognized Developer - OP
Thanks Meter 63
Posts: 1,269
Join Date: Dec 2008
Location: Brussels

 
DONATE TO ME
Default [MortScript] iniEditor: get a friendly menu out of an .ini file!

It's very usefull as a developper to use .ini file to store settings of apps or MortScript scripts.

Unfortunately, you may have so many complicated settings (check IPTWeather for instance ), that you or newbies would like to be able to edit those settings without having to open the .ini configuration file.

That's why I've created the iniEditor.mscr script to get a friendly menu out of an .ini file:

This is more a proof of concept, and I would really like some developper can port it to a real .exe app to have a great layout as in the S2U2 settings for instance!

It can be used for any app or MortScript script that uses a .ini configuration file.

In the attachment, checkout the iniEditor.mscr which needs two parameters: the .ini file to edit, and your application name.

I've attached:
- the 'iniEditor.mscr' script which is the generic .ini file parser and configurator.
- the 'sample.ini' file to be edited.
- the 'sample.ini.desc' file that is the description file so you can remove all the comments in the 'sample.ini' file but still have them in the iniEditor menus to improve speed performance of your apps reading the 'sample.ini' file! All values in the 'sample.ini.desc' are the default values that are proposed if you cancel your changes for a field.
- the 'sampleConfig.mscr' script which calls the 'iniEditor.mscr' script with the right arguments.
- the 'calledScript.mscr' script which is called for one of the settings.

For the moment, you can set four types for the different settings:
- list: the setting is in a choice list defined in the .ini file;
- int: the setting is an integer;
- callscript: the setting is set using a MortScript script defined in the .ini file;
- fullfilepath: the setting is the full path of a file, to be set with a specific selection dialog box;
- path: the setting is a path, to be set with a specific selection dialog box;
- default: the setting is any entered string.

You set the type of a setting in the .ini.desc file by adding a comment just after the settings, like that:
Code:
[Some settings]
enableFeatureA=0
;list,0,1
You can also add some comments to be displayed for the user, by adding comments (on several lines if you want), like that:
Code:
[Some settings]
enableFeatureA=0
;list,0,1
;Set 0 to disable Feature A.
;Set 1 to enable Feature A.
And that gives you that:


Sometimes, there are so many things to say on a setting, that you don't want to or can't display all the comments about a setting in the menus of iniEditor.mscr.
Then, just added two semicolons at the beginning of the first "comment" line (after the "type" line"), like that:
Code:
advancedSetting=
;
;;Please check FAQ or sample.ini.desc file for more help on this setting.
;This is an advanved option.
;It is so long to explain how it works.
;I cannot show it in a MortScript message dialog box.
;But your are an advanced user.
;So you can find some tips directly here, but not through the iniEditor.mscr script.
And that gives you that:


If you set a parameter of type int, the user will be able to enter only an integer value:


If you set a parameter of type fullfilepath, you get this:


If you set a parameter of type path, you get this:


Feel free to use or modify my iniEditor.mscr, and if someone could make a real .exe app out of it, that would be great!
Attached Thumbnails
Click image for larger version

Name:	EnterNewStringValue.jpg
Views:	124
Size:	33.0 KB
ID:	408235   Click image for larger version

Name:	EnterNewIntegerValue.jpg
Views:	72
Size:	21.7 KB
ID:	408236   Click image for larger version

Name:	ChooseValueFromList.jpg
Views:	121
Size:	17.6 KB
ID:	408237   Click image for larger version

Name:	ChooseValueFromList2.jpg
Views:	52
Size:	21.8 KB
ID:	408238   Click image for larger version

Name:	fullfilepath.jpg
Views:	77
Size:	34.4 KB
ID:	409083  

Click image for larger version

Name:	path.jpg
Views:	74
Size:	42.7 KB
ID:	409084   Click image for larger version

Name:	iniEditor.gif
Views:	1647
Size:	76.5 KB
ID:	409653  
Attached Files
File Type: zip iniEditor_v05.zip - [Click for QR Code] (3.3 KB, 229 views)
Device: HTC Touch HD
ROM: kwbr 5.6 :: Sense 2.5 :: wm6.5 (21914)
ROM Date: 11/17/2010
OS: CE OS 5.2.21914
Radio: 1.17.25.09

My contributions: IPTWeather (weather in iPhoneToday and/or S2U2), iniEditor, Reviewed Cendaryn's MyMetroLock
If you like my work, buy me a beer :


tronikos iPhoneToday 1.5.3 changelogs
Latest tronikos' iPhoneToday (v1.5.4 = v1.5.3 without bugs)
 
JMHL
Old
#2  
Recognized Developer
Thanks Meter 83
Posts: 650
Join Date: Apr 2006
Location: Bordeaux

 
DONATE TO ME
Wink Pas mal !

Bon outils (qui simplifie la vie) comme je les aime !

A++
If you like my work, thank you for offering me a beer. All donations are appreciated !
-> *Donate* <-
Contributions to XDA : JMLToday, JMLPanex, JMLStocks, JMLLauncher, JML...Tools, JMLPicture, JMLMenuSense etc...
If you use one of these programs in your developments/skins that have donations, thanks for a small donation.
 
michoob
Old
#3  
michoob's Avatar
Recognized Developer - OP
Thanks Meter 63
Posts: 1,269
Join Date: Dec 2008
Location: Brussels

 
DONATE TO ME
Thank you for your support JMHL .

I know I'm alone in my ini editor trip, but I've added two types of parameters: fullfilepath and path.
Just check the first post to have more information on these.

Still no one motivated to developp this in CF.Net for instance?
Device: HTC Touch HD
ROM: kwbr 5.6 :: Sense 2.5 :: wm6.5 (21914)
ROM Date: 11/17/2010
OS: CE OS 5.2.21914
Radio: 1.17.25.09

My contributions: IPTWeather (weather in iPhoneToday and/or S2U2), iniEditor, Reviewed Cendaryn's MyMetroLock
If you like my work, buy me a beer :


tronikos iPhoneToday 1.5.3 changelogs
Latest tronikos' iPhoneToday (v1.5.4 = v1.5.3 without bugs)
 
michoob
Old
#4  
michoob's Avatar
Recognized Developer - OP
Thanks Meter 63
Posts: 1,269
Join Date: Dec 2008
Location: Brussels

 
DONATE TO ME
I've seen that two people have downloaded my second version of iniEditor.
Please find in the first post a new version with a small bug corrected.
Device: HTC Touch HD
ROM: kwbr 5.6 :: Sense 2.5 :: wm6.5 (21914)
ROM Date: 11/17/2010
OS: CE OS 5.2.21914
Radio: 1.17.25.09

My contributions: IPTWeather (weather in iPhoneToday and/or S2U2), iniEditor, Reviewed Cendaryn's MyMetroLock
If you like my work, buy me a beer :


tronikos iPhoneToday 1.5.3 changelogs
Latest tronikos' iPhoneToday (v1.5.4 = v1.5.3 without bugs)
 
sv0911
Old
#5  
sv0911's Avatar
Senior Member
Thanks Meter 288
Posts: 678
Join Date: May 2010
Location: Baden-Baden
Hi michoob,

A BIG THANKS for your new fantastic MortScript app...!!!!
As usual a great work...!!!!

I will of course use it also in my apps...!!!!

Greetings
sv0911
"If you like my work...... go and by yourself a drink... and enjoy the ride......"

My latest dedications to xda:
+ T H E M E Harmony Blue
+ T H E M E Gingerfire Black
+ T H E M E Gingerfire Blue
+ T H E M E Black Chrome
+ T H E M E White Chrome
+ T H E M E Glowing Blue

..more releases on my profile statistics...

 
jwoegerbauer
Old
#6  
jwoegerbauer's Avatar
Senior Member
Thanks Meter 187
Posts: 547
Join Date: Jul 2009
Location: Bavaria (Germany)
Thumbs up Thanks, thanks and again thanks

michoob,

a really great job you did! Extremely user friendly and tremendously fast!
 
michoob
Old
#7  
michoob's Avatar
Recognized Developer - OP
Thanks Meter 63
Posts: 1,269
Join Date: Dec 2008
Location: Brussels

 
DONATE TO ME
You're welcome jwoegerbauer!
Device: HTC Touch HD
ROM: kwbr 5.6 :: Sense 2.5 :: wm6.5 (21914)
ROM Date: 11/17/2010
OS: CE OS 5.2.21914
Radio: 1.17.25.09

My contributions: IPTWeather (weather in iPhoneToday and/or S2U2), iniEditor, Reviewed Cendaryn's MyMetroLock
If you like my work, buy me a beer :


tronikos iPhoneToday 1.5.3 changelogs
Latest tronikos' iPhoneToday (v1.5.4 = v1.5.3 without bugs)
 
jwoegerbauer
Old
(Last edited by jwoegerbauer; 30th November 2010 at 08:43 AM.)
#8  
jwoegerbauer's Avatar
Senior Member
Thanks Meter 187
Posts: 547
Join Date: Jul 2009
Location: Bavaria (Germany)
Quote:
Originally Posted by michoob View Post
Feel free to use or modify my iniEditor.mscr
I followed your invitation. These are the 2 changes I mainly made in my copy of your iniEditor.mscr

Code:
Copy(fileName, fileName & ".bak", 1)
iniChanged = 0
choosenSection = 1
While (choosenSection <> 0)
	choosenSection = Choice(appName & " settings", "Please choose a settings section:", 0,0, sectionList)
	If (choosenSection <> 0)
		Call("IPTWkeys")
	EndIf
EndWhile
If(not iniChanged)
	Delete(fileName & ".bak")
EndIf


If (confirmation)
	valueList[choosenKey] = newValue
	keyValueList[choosenKey] = keyList[choosenKey] & "=" & newValue
	IniWrite(fileName, sectionList[choosenSection], keyList[choosenKey], newValue)
	iniChanged += 1
EndIf
 
michoob
Old
#9  
michoob's Avatar
Recognized Developer - OP
Thanks Meter 63
Posts: 1,269
Join Date: Dec 2008
Location: Brussels

 
DONATE TO ME
I've just updated the iniEditor.mscr script with a new feature really usefull when you have huge .ini files to improve reading performance of your .ini file and have your MortScript apps run faster!
This new feature is the use of the .ini.desc file that contains all default values and all the comment structure of iniEditor. Now, the .ini file can be comment free and still you'll have all the information while editing your .ini file through iniEditor!

As usual, you can test this new version with IPTWeather.

Feedbacks welcomed!
Device: HTC Touch HD
ROM: kwbr 5.6 :: Sense 2.5 :: wm6.5 (21914)
ROM Date: 11/17/2010
OS: CE OS 5.2.21914
Radio: 1.17.25.09

My contributions: IPTWeather (weather in iPhoneToday and/or S2U2), iniEditor, Reviewed Cendaryn's MyMetroLock
If you like my work, buy me a beer :


tronikos iPhoneToday 1.5.3 changelogs
Latest tronikos' iPhoneToday (v1.5.4 = v1.5.3 without bugs)
 
jwoegerbauer
Old
#10  
jwoegerbauer's Avatar
Senior Member
Thanks Meter 187
Posts: 547
Join Date: Jul 2009
Location: Bavaria (Germany)
Quote:
Originally Posted by michoob View Post
I've just updated the iniEditor.mscr script with a new feature really usefull when you have huge .ini files to improve reading performance of your .ini file and have your MortScript apps run faster!
This new feature is the use of the .ini.desc file that contains all default values and all the comment structure of iniEditor. Now, the .ini file can be comment free and still you'll have all the information while editing your .ini file through iniEditor!
Tried v04. Simply an ingenious improvement. Thanks.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes