INI editor

By SilentExile on Sep 17, 2007

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

  • adding/removing an item *

Just use the +/- buttons and from there it is easy. Make sure you have an item the list in the topics box selected.

  • adding topics *

Click the '+' button under the topics box and there you are

  • creating a new ini file *

Just click the '+' button next to the combo list. There is no need to specify a .ini at the end of the name.

  • removing a file *

Click the '-' button next to the combo list and make sure to have a selected item in the list. Otherwise nothing will happen.

  • editing item data *

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
}

Comments

Sign in to comment.
guest598594   -  Sep 26, 2007

i changed my mine, id rather type /run file.ini and edit it in there

you need to disable removes, and also disable the adds when theres no ini selected

 Respond  
guest598594   -  Sep 26, 2007

i guess ill just use this, i need a ini editor, and this is the only one on here

 Respond  
guest598594   -  Sep 25, 2007

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...
}
 Respond  
guest598594   -  Sep 25, 2007

ugh, make the bottom one

  list 4, 76 9 47 89, size sort
 Respond  
guest598594   -  Sep 25, 2007
  list 1, 14 9 46 87, size sort
  list 4, 76 9 47 89, size

^^much more helpful if you sort them

 Respond  
SilentExile   -  Sep 20, 2007

er.. thanks. =) I am truly sorry that I don\'t have an answer to your problem.

 Respond  
noMen   -  Sep 20, 2007

Well the new one also contains combo 7, 5 118 82 13, drop. 13 is not much .... well it works for you, I\'m happy for you

 Respond  
SilentExile   -  Sep 20, 2007

That looks like the old version of this snippet. Have you tried the new one? I have no clue why that happens without the size option.

 Respond  
noMen   -  Sep 20, 2007

Uploaded, look for yourself. Made in mirc 6.21

 Respond  
SilentExile   -  Sep 20, 2007

I honestly haven\'t a clue on why your mIRC reicieves that problem. Everything worked fine for me and so far I haven\'t recieved any issues.

 Respond  
xDaeMoN   -  Sep 20, 2007

There\'s an upload option in the navigation on top to upload images.

 Respond  
guest598594   -  Sep 20, 2007

umm, i know u can on the forum, but im not sure about on comments, but try it, its [i m g]site[/i m g]

 Respond  
noMen   -  Sep 20, 2007

I just tested it in 6.21, same problem. Can I upload a screenshot somewhere?

 Respond  
SilentExile   -  Sep 20, 2007

noMen, that shouldn\'t affect the combo at all. If I had a size after the x y w h parameters then that would come into effect. Without the forced size effect, it automatically readjusts itself. As xDaeMoN has stated, this was tested in 6.21 so that could be the problem.

 Respond  
xDaeMoN   -  Sep 20, 2007

I have tested the code in 6.21 & works fine. I did not test it in 6.3 yet but I would think it would work fine as well. You might want to try updating your mirc.

 Respond  
noMen   -  Sep 20, 2007

@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).

 Respond  
xDaeMoN   -  Sep 20, 2007

@ noMen, yep I didn\'t have a problem on the combo box. I was able to see all the INI files in the drop down menu.

 Respond  
noMen   -  Sep 20, 2007

I\'ll help you ... dude, change:

combo 7, 5 118 82 13, drop 

into:

combo 7, 5 118 82 100, drop

Only then I see the files when I click the down arrow of the combo-box.
Did anybody test this seriously??? xDaemon too????

 Respond  
SilentExile   -  Sep 19, 2007

updates

added the option to add an ini file and remove an ini file
added the option to add a topic
edited dialog size

 Respond  
SilentExile   -  Sep 19, 2007

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?

 Respond  
noMen   -  Sep 19, 2007

The combo list stays empty when I call the dialog. I can only enter a letter and after that the ini files are shown in the table list. The idea is good, but it needs some rework.

 Respond  
xDaeMoN   -  Sep 19, 2007

The combo list works fine. This is lacking features if you call this an editor.

  1. you can add new items/data but not able to edit them
  2. add an option to create new ini files
 Respond  
noMen   -  Sep 19, 2007

After you have added something you should test it ... dude. Now get the combo list working ($dname 7).

 Respond  
SilentExile   -  Sep 18, 2007

Ugh I am sorry, I meant mountaindew.

 Respond  
SilentExile   -  Sep 18, 2007

Dude the popup menu was added after the comment moundtaindew made. The bottom line of the code was the alias. I made on mistake with the bracket and didn\'t realize that because I didn\'t feel like opening up my mIRC when I could have easily written the code as I submitted it.

 Respond  
noMen   -  Sep 18, 2007

If it is only me with the problem why did you add a bracket? The code you gave originally doesn\'t show the popup menu! It was NOT tested!

 Respond  
SilentExile   -  Sep 18, 2007

This has been tested with and without other scripts on my mIRC and a new one. Everything worked as expected with no errors. Everyone else seemed to have no errors so I assume it is just you with the problem. I remove the return %c and added the extra bracket. Thank you noMen for pointing that out.

 Respond  
noMen   -  Sep 18, 2007

I have given it 2 two points, because obviously it wasn\'t ripped...

 Respond  
noMen   -  Sep 18, 2007

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

 Respond  
Lindrian   -  Sep 18, 2007

menu * are SO annoying... Don\'t use them.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.