INI Manager — File Browser

INIManagerv1.0 / INIManagerv1.0 / inimgr.mrc

inimgr.mrc — 1.44 KB — Download this file

on *:LOAD:echo -a $color(echo) * INI Manager by zacke loaded. | echo -a $color(echo) * Type /_inimgr to use.
menu menubar {
  INI Manager:_inimgr
}
alias _inimgr dialog -om inimgr inimgr
dialog inimgr {
  title "INI Manager [/_inimgr]"
  size -1 -1 180 121
  option dbu
  text "File:", 1, 4 5 10 8
  edit "", 2, 17 4 142 10,read
  button "...", 3, 161 4 15 10
  box "", 4, 4 15 172 103
  text "Sections", 5, 25 24 20 8
  list 6, 8 35 55 80, sort size vsbar
  text "Keys", 7, 112 24 12 8, center
  list 8, 64 34 108 70, size
  text "Value:", 9, 64 106 15 8, center
  edit "", 10, 80 105 92 10
  button "", 11, 0 0 0 0, hide disable ok
}
on *:dialog:inimgr:sclick:*:{
  if ($did == 3) { 
    var %file = $+(",$sfile($mircdir,Pick an INI-Style file to manage,Manage),") | did -ra $dname 2 %file
    did -r $dname 6,8,10
    var %sections = $ini(%file,0),%ctr = 1
    while (%ctr <= %sections) { did -a $dname 6 $ini(%file,%ctr) | inc %ctr }
  }
  if ($did == 6) {
    did -r $dname 8
    var %file = $did(2),%keys = $ini(%file,$did(6).seltext,0),%ctr = 1
    while (%ctr <= %keys) { did -a $dname 8 $ini(%file,$did(6).seltext,%ctr) | inc %ctr }
  }
  if ($did == 8) {
    var %file = $did(2),%val = $readini(%file,$did(6).seltext,$did(8).seltext)
    did -ra $dname 10 %val
  }
}
on *:dialog:inimgr:edit:10:{
  if ($did(2) && $did(6).seltext && $did(8).seltext) { writeini -n $did(2) $did(6).seltext $did(8).seltext $did(10) }
}