A dialog that allows you to completely handle ini files. You have the option to; create and remove ini files, add topics, add and remove items, and edit item data. Any comments, suggestions, or feedback is extremely appreciated.
usage
Just use the +/- buttons and from there it is easy. Make sure you have an item the list in the topics box selected.
Click the '+' button under the topics box and there you are
Just click the '+' button next to the combo list. There is no need to specify a .ini at the end of the name.
Click the '-' button next to the combo list and make sure to have a selected item in the list. Otherwise nothing will happen.
Just use the edit box next to 'table data' and it will edit the text input. If there is no text in the editbox, it will do nothing.
dialog initable {
title "INI manager"
size -1 -1 142 160
option dbu
list 1, 14 9 46 87, size
box "Topics", 2, 12 2 54 98
box "Items", 3, 74 2 54 98
list 4, 76 9 47 89, size
edit "", 5, 34 132 102 10, read
text "Table name:", 6, 1 134 30 8
combo 7, 5 118 82 13, drop
button "+", 8, 76 102 25 12
button "-", 9, 101 102 25 12
text "Table data:", 10, 1 146 29 8
edit "", 11, 34 146 102 10, autohs
button "-", 13, 111 118 23 11
button "+", 14, 24 101 23 11
button "+", 12, 88 118 23 11
}
on *:dialog:initable:init:0:{
var %c = $findfile($mircdir,*.ini,0,did -a $dname 7 $nopath($1-))
}
on *:dialog:initable:sclick:1:{
var %i = $did($dname,7).seltext
var %y = 1
did -r $dname 4
while ($ini(%i,$did($dname,1).sel,%y)) {
did -a $dname 4 $v1 | inc %y
}
did -ra $dname 5 $did($dname,1).seltext
if ($did($dname,11).text) did -r $dname 11
}
on *:dialog:initable:sclick:7:{
var %x = 1
did -r $dname 1
did -r $dname 4
while ($ini($did($dname,7).seltext,%x)) {
did -a $dname 1 $v1 | inc %x
}
}
on *:dialog:initable:sclick:4:{
did -ra $dname 5 $did($dname,4).seltext
if ($readini($did($dname,7).text,$did($dname,1).seltext,$did($dname,4).seltext)) {
did -ra $dname 11 $v1
}
}
on *:dialog:initable:edit:11:{
if ($did($dname,11).text) {
writeini -n $did($dname,7).seltext $did($dname,1).seltext $did($dname,4).seltext $did($dname,11).text
}
}
on *:dialog:initable:sclick:8:{
var %t = $?="Enter item name", %i = $?="Enter item data"
if (!$readini($did($dname,7).seltext,$did($dname,1).seltext,%t)) {
writeini -n $did($dname,7).seltext $did($dname,1).seltext %t %i
did -a $dname 4 %t
}
}
on *:dialog:initable:sclick:9:{
if ($readini($did($dname,7).seltext,$did($dname,1).seltext,$did($dname,4).seltext)) {
remini $did($dname,7).seltext $did($dname,1).seltext $did($dname,4).seltext
did -d $dname 4 $did($dname,4).sel
did -r $dname 5
did -r $dname 11
}
}
on *:dialog:initable:sclick:12:{
var %1 = $?="Enter name of ini file"
set -nu1 %2 %1
if ($gettok(%2,1-,32)) {
writeini -n $+(%2,.,ini) aux1 23 20
remini $+(%2,.,ini) aux1 23
remini $+(%2,.,ini) aux1
did -a $dname 7 $+(%2,.,ini)
}
else { return }
}
on *:dialog:initable:sclick:13:{
if ($did($dname,7).sel) {
remove -b $did($dname,7).seltext
did -d $dname 7 $did($dname,7).sel
}
}
on *:dialog:initable:sclick:14:{
var %c = $?="Enter topic name:"
set -nu1 %u2k %c
if ($gettok(%u2k,1-,32)) {
if (!$ini($did($dname,7).seltext,%u2k)) {
writeini -n $did($dname,7).seltext %u2k test k1
remini $did($dname,7).seltext %u2k test
did -a $dname 1 %u2k
}
}
}
alias ini.dialog { if (!$dialog(initable)) { dialog -m initable initable } }
menu menubar {
INI editor:ini.dialog
}
u need to friggin test ur script
when you try to add an item, it asks for item, data, then asks for item and data again
also, you should disable the - in the items until you click an item
when you remove stuff, i think that this would come in handy:
echo $$?!=\"Are you sure you would like to remove $did(name,id).seltext $+ ?)\"
if ($! == $true) {
do remove stuff...
}
@xDaemon: you must have very good eyes to see all those files in a blue selection bar with a height of about one pixel . Or you don\'t have any ini files at all. \"combo 7, 5 118 82 13, drop\" drops down the combo list at most 13 dbu\'s down which is just a little bit more than the height of the edit field in the combi list. At least it is in my mIRC version (6.17).
xDaeMoN, you should be able to edit things. when you dclick the item it displays it in the editbox, allowing you to edit it all you want. as long as you have something in the editbox it will be fine. However, if there is no text in the editbox then nothing will happen. On the contrary, I am adding options to remove and create new ini files so that is on the way. =)
noMen, I have no clue why you are receiving that error. Due to it working for everyone else, I would have to say everything is in check. What would you like to see in a future update?
Nice idea ... but did you test it wel? No you didn\'t.
on *:dialog:initable:init:0:{
var %c = $findfile($mircdir,*.ini,0,did -a $dname 7 $nopath($1-))
return %c
}
This doesn\'t fill the filelist with the ini.files. %c will only contain the number of ini files that were found. And what is that return %c doing there?
alias ini.dialog { if (!$dialog(initable)) { dialog -m initable initable }
There is a } missing here with the result that the menu n\'t shown in the menubar.
I\'ll give it a \"1\" for the time you spend on it ...
bweh