Plug'n'Play GUI Settings Editor for your scripts (Version 6)
Background:
I made a script that was to be used by others. It saved its settings in a .ini file but to configure it I didn't create a GUI (why... coz its too much work, and one might as well use notepad to edit a damn ini file!). But i recd requests from friends that its too geeky to edit settings in notepad and they're having trouble so i should give them a better user interface! (damn!)
So instead of building a simple settings editor in that script I went the loooong waaaay... I made a function that can be just plugged into any script that saves its options in a .ini and you'll get an instant Settings Editor GUI !!
Ok, that was the background... (i know you didn't ask for it, but bear with me)
Back to Current Day:
toralf made wonderful improvements to the original function and took it to newer heights and added many features to it. Then i did some mods to it and then he modded my mod which was originally his mod which in turn was my original script. (blah.. blah)
Anyways, today we have a great working function that can easily be plugged into any script that saves its settings in a .ini file, and it has an instant Settings/Options window (screenshot below). And it doesn't use a single global variable (that was the tricky part for me!), so its completely compatible with any script.
Ini Editor:
Also, toralf made a very nice editor for .ini files (screenshot below), to be used specifically with the above function. Though any .ini can be directly used with the function without any modification, this editor enables you to avail some great features of the function.
Downloads:
(Usage instructions in the function file)
Ini Settings Editor Function Version 6
Ini File Creator Version 8 (requires Anchor 3.3)
Screenshots:
Ini Editor Function
Ini File Creator
CleanNews.in : Bite sized latest news headlines from India with zero bloat
Thank you,
Kerry
Error: This variable or function name contains an illegal character. The Current Thread Will Exit
IDInstallation Options
ID%CurrSec% := TV_Add(CurrSec)
any suggestions?
EDIT:
The error is that it doesn't like sections with spaces between them, don't know how to fix this myself, nor if you want to go through the trouble to do so.
toralf
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.
And yes, I love you ;D
I have only two possible improvement for reliability:
1)
You should use "Gui, Destroy" instead of "Gui, Submit".
The reason why should be clear after this lines of code:
EditSettings("Rajat", A_ScriptDir . "\test.ini") msgbox EditSettings("Rajat", A_ScriptDir . "\test.ini")This causes a wonderfull new style for your GUI
2)
You could replace
;a Gui that would probably not exist in parent script Gui, 54:Defaultby something like this:
Loop, 86 { Index := A_Index + 12 ;overjumps the first few normally used GUI-Numbers... Gui %Index%:+LastFoundExist IfWinNotExist { Gui, %Index%:Default break } }But this may also cause problems with later appearing Sub-Windows...
Thalon
spaces did occur to me while making this but i only thought about keys, and they probably don't support spaces so i thought no problem... but thanks for bringing this to my notice. i first thought of useing my Hex2Asc / Asc2Hex to fix spaces but now i've thought of a better approach that just might work... keep watching ths space!
Thalon,
hey that Gui Destory thing is really good, thanks for that! and about the other tip, it might (as u've already mentioned) mess with future GUIs in script so i guess i'll be sticking with Gui, 54!
CleanNews.in : Bite sized latest news headlines from India with zero bloat
See Rajat's first post for our joint work.
toralf
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.
Added key types "Float" and "Integer", with consistancy check
to the above script.
toralf
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.
for supporting spaces i'd also thought of using IDs instead of names to make variable names. i've not yet seen what've u used to replace the 0.5s sleep.
by the way for future enhancements:
- i don't think editing desc/key/section is reqd, as i've not yet seen an app that allows to 'ADD' options to it, instead of modifying them.
- adding support for date and hotkey controls could be useful
CleanNews.in : Bite sized latest news headlines from India with zero bloat
CleanNews.in : Bite sized latest news headlines from India with zero bloat
Common Rajat, you started this, I had to digest your code first. And it is as always excellent. You'll get it, I'm sure.wow toralf! you've greatly improved the function! (and made it too complicated for me to understand! ;) )
It is only the order when the code breaks the loop if the GUI is closed. Your code left the loop before the sleep. By accident I closed the GUI during the sleep, the next lines tried to get the value which was nothing since the GUI was closed and wrote an empty value to the ini. No the loop is left after the sleep.for supporting spaces i'd also thought of using IDs instead of names to make variable names. i've not yet seen what've u used to replace the 0.5s sleep.
I agree. I was thinking to be able to build an ini with this during coding. But it will make the code much more complex. I guess the INI was to be written by hand or with a mod of Titans VisualIni script.by the way for future enhancements:
- i don't think editing desc/key/section is reqd, as i've not yet seen an app that allows to 'ADD' options to it, instead of modifying them.
- adding support for date and hotkey controls could be useful
The date and hotkey key parameters are a good idea, but how to do a consitancy check? Maybe replace the Edit control with a date and hotkey control?!?
toralf
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.
CleanNews.in : Bite sized latest news headlines from India with zero bloat
in above script
toralf
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.
next request:
- a button, when pressed gives me 100 bucks
CleanNews.in : Bite sized latest news headlines from India with zero bloat
BtnRajat: MsgBox, Paypal wires you 100 Bucks ReturnSomething like this?
toralf
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.