So, I'm creating a script that will transfer tons of single-line data from one file to another that I can monitor and select myself. As I'm just starting out I only have the basic stuff figured out as of yet, so I might come back for more questions. Anyhow, here's my current question:

I want to make a category feature to categorize my strings. There are 3 values I look for in each string and I'd like to be able to sort them all using an .ini file's Section and Value to differentiate where they should be placed. For instance, I have an .ini file with values that look like this:
Click to reveal..
Originally Posted By: Test.ini
;This is my current test .ini layout I'm using now.
[Offered]
Reaves^Fails^Episode^83v2=1
SUNSfan^Fails^Episode^83v3=1
Neil^Headshots^v34
Reaves^Headshots^v34
;As you can see, I don't have the organization's name "DotaCinema" showing anywhere in here. I'd like for it to be more organized in the future so it's easier for me to manipulate the values.

;This is my future .ini layout that I want to use
[DotaCinema]
1=Reaves Fails Episode 83v2
9=SUNSfan Fails Episode 83v3
11=Neil Headshots v34
13=Reaves Headshots v34
;Note: The numbers have no meaning at all. They just increase as per each add.
What I'd like to do is to use the Section (DotaCinema) as the head of the category (Look at IRC on the picture), then I'd like for $1 of the value (Reaves) to be a sub category inside the head category which would then have the values "Episode 83v2" and "Headshots v34" inside of it.
This picture will serve as a reference to my example.


I'm including the script so you can try it yourself if you'd like to know what it looks like, feel free to take parts or ideas out of it as well, I was inspired by another user's post just recently anyway and decided to create this.
Click to reveal..
Code:
Menu channel {
  Test : Strings.Test
}


alias -l Strings.Test {
  dialog -m strings strings
  list
}

;# Refresh both lists with up-to-date values.
alias -l list { 
  var %file test.ini

  ;# Flush both sides so that they are empty.
  did -r strings 100
  did -r strings 200

  ;# Placeholder for future references, %sort will allow me to display the values with different under different category orders.
  var %sort $iif($readini(test.ini,sort,preference),$v1,organization)
  if (%sort == organization) {

    ;# Adds values to left combo list
    var %i 1, %action offered, %lines $ini(%file,%action,0)
    while (%i <= %lines) {
      var %value $no^($ini(%file,%action,%i))
      did -a strings 100 %value
      inc %i
    }

    ;# Adds values to right combo list
    var %i 1, %action active, %lines $ini(%file,%action,0)
    while (%i <= %lines) {
      var %value $no^($ini(%file,%action,%i))
      did -a strings 200 %value
      inc %i
    }
  }
}



dialog strings {
  title "Strings List"
  size -1 -1 216 142
  option dbu

  box "Offered List", 1, 2 2 106 116
  combo 100, 5 10 100 106, sort

  box "Active List", 2, 108 2 106 116
  ;# The reason I'm using combo instead of list is cause one of my future wishes are to make the edit box above function as a search bar as well.
  combo 200, 111 10 100 106, sort

  box "Sort By", 3, 2 118 106 22

  ;# These buttons will write the preferred layout to display the values.
  button "Organization", 4, 4 124 34 14
  button "Personality", 5, 38 124 34 14
  button "Value", 6, 72 124 34 14

  button "Reset", 7, 108 120 106 20
}

on *:dialog:strings:sclick:7: {
  var %file test.ini, %lines $ini(%file,active,0)

  ;## Use the MOVE alias for this in the future. 

  ;# This resets the right combo list. 
  while (%lines) { 
    writeini %file offered $ini(%file,active,%lines) 1
    remini %file active $ini(%file,active,%lines) 
    dec %lines
  }

  list
}

on *:dialog:strings:dclick:100,200: {   
  var %dialog $dname, %action $iif($did == 100,add,rem), %value $did($did).seltext 
  move %dialog %action %value
}

alias -l move {
  var %dialog $1, %action $2, %value $^($3-), %file test.ini

  ;## Make prettier echo text.
  echo 3 -ag $capital(%action) $+ $iif(%action == rem,oved $qt($3-) from,ed $qt($3-) to) the active list.  

  ;# Deletes it from one side and adds it to the other
  writeini %file $iif(%action == add,active,offered) %value 1
  remini %file $iif(%action == rem,active,offered) %value

  ;# Calls for the refresh again which will update the values shown.
  list
}

;# This is used to remove the ^ from the string.
alias no^ return $replace($1-,$chr(94),$chr(32))

;# This is used to add ^ to the string instead of spaces. 
;# The reason I do this is so it can be used as an item in the ini files.
alias ^ return $replace($1-,$chr(32),$chr(94))

;# This let's me capitalize the first letter of the string.
alias capital return $upper($left($1,1)) $+ $mid($1,2-)
Any help would be greatly appreciated.

Thanks.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net