mIRC Home    About    Download    Register    News    Help

Print Thread
#116355 04/04/05 01:27 PM
T
The_Only
The_Only
T
So... here's the problem.
I made a combo box type "list". But when I add a new item through the button i designed, it appears at the top. Is there a way to make the list-box fill in the same order as the data is stored as different lines in the *.ini file? I mean... the new item to be added is stored as a new line at the bottom of the *.ini. So can the item appear at the bottom in the box too?

#116356 04/04/05 02:05 PM
Joined: Dec 2002
Posts: 3,534
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,534
Just something I whipped up, it doesn't read from an INI file though. Simple *.txt.

But it does load the data the order you added it.

Code:
dialog com {
  title "Com"
  size -1 -1 64 116
  option dbu
  combo 1, 2 2 60 90, size
  button "Add", 2, 11 94 15 8
  button "Del", 3, 38 94 15 8
  button "Close", 4, 4 106 55 8
}


On *:Dialog:com:init:0: {
  if ($lines(com.txt) >= 1) { .play -s com.txt 10 }
}

On *:Dialog:com:sclick:2: {
  if ($did(1)) {
    if ($read(com.txt,w,did -a com 1 $did($dname,1))) { echo -a $did(1) already exists. | halt }
    did -a $dname 1 $did(1)
    write com.txt did -a com 1 $did($dname,1)
    echo -a Added $+($did($dname,1),.)
  }
}

On *:Dialog:com:sclick:3: {
  if ($did(1).sel) {
    did -d $dname 1 $did(1).sel
    write -dw $+("*,$did(1).sel,*") com.txt
    echo -a Deleted $+($did($dname,1),.)
  }
}

On *:Dialog:com:sclick:4: {
  dialog -x com com
}

#116357 04/04/05 02:18 PM
T
The_Only
The_Only
T
Thanks.

Oh yeah! Another question. Since the data in my "database" *.txt file is a list of IPs (each on new line) to be ignored, is there a way to make mirc always add them to the ignore list in the Address Book on start?

#116358 04/04/05 02:22 PM
Joined: Dec 2002
Posts: 3,534
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,534
Code:
On *:Start: {
  var %x = $lines(database.txt)
  while (%x) {
    ignore $gettok($read(database.txt,%x),5,32)
    dec %x
  }
}

dialog database {
  title "The Only"
  size -1 -1 64 116
  option dbu
  combo 1, 2 2 60 90, size
  button "Add", 2, 11 94 15 8
  button "Del", 3, 38 94 15 8
  button "Close", 4, 4 106 55 8
}


On *:Dialog:database:init:0: {
  if ($lines(database.txt) >= 1) { .play -s database.txt 10 }
}

On *:Dialog:database:sclick:2: {
  if ($did(1)) {
    if ($read(database.txt,w,did -a database 1 $did($dname,1))) { echo -a $did(1) already exists. | halt }
    did -a $dname 1 $did(1)
    write database.txt did -a database 1 $did($dname,1)
    echo -a Added $+($did($dname,1),.)
  }
}

On *:Dialog:database:sclick:3: {
  if ($did(1).sel) {
    did -d $dname 1 $did(1).sel
    write -dw $+("*,$did(1).sel,*") database.txt
    echo -a Deleted $+($did($dname,1),.)
  }
}

On *:Dialog:database:sclick:4: {
  dialog -x database database
}

Last edited by SladeKraven; 04/04/05 02:24 PM.
#116359 04/04/05 02:23 PM
T
The_Only
The_Only
T
by the way... sorry it wasn't a combo box frown
Code:
list 4, 7 50 134 154, size extsel vsbar

A list box...
Sorry

#116360 04/04/05 02:36 PM
Joined: Dec 2002
Posts: 3,534
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,534
Ok, well I've added an edit control and a list to make it look like a combo hehehe...
Code:
On *:Start: {
  var %x = $lines(database.txt)
  while (%x) {
    ignore $gettok($read(database.txt,%x),5,32)
    dec %x
  }
}

dialog database {
  title "database"
  size -1 -1 66 116
  option dbu
  list 1, 3 14 60 80, size
  button "Add", 2, 11 96 15 8
  button "Del", 3, 38 96 15 8
  button "Close", 4, 4 106 55 8
  edit "", 5, 3 2 60 10
}

On *:Dialog:database:init:0: {
  if ($lines(database.txt) >= 1) { .play -s database.txt 10 }
}

On *:Dialog:database:sclick:2: {
  if ($did(5)) {
    if ($read(database.txt,w,did -a database 1 $did($dname,5))) { echo -a $did(5) already exists. | halt }
    did -a $dname 1 $did(5)
    write database.txt did -a database 1 $did($dname,5)
    echo -a Added $+($did($dname,5),.)
  }
}

On *:Dialog:database:sclick:3: {
  if ($did(1).sel) {
    did -d $dname 1 $did(1).sel
    write -dw $+("*,$did(1).sel,*") database.txt
    echo -a Deleted $+($did($dname,1),.)
  }
}

On *:Dialog:database:sclick:4: {
  dialog -x database database
}

#116361 04/04/05 03:23 PM
T
The_Only
The_Only
T
Thanks pal smile It works great!

And sorry that I said "combo" box... They look almost the same and I got confused :P

Offtopic: Can anyone see my avatar? Because it's uploaded on a Bulgarian free server and I'm not sure if the server could be accessed from foreign countries.

#116362 04/04/05 03:26 PM
Joined: Dec 2002
Posts: 3,534
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,534
You're welcome mate. smile

#116363 04/04/05 03:42 PM
T
The_Only
The_Only
T
Doh I found a bug.

When you open the dialog "database" ( /dialog -m database database ) and for example you fill in 4 texts. They appear and when you load the dialog again they appear at the same order. But when you select for example the last one or the 3rd one or whatever and press "del" it deletes it but when you reopen the diaolg you can see that it actually deleted the first line, not the one you selected,

#116364 04/04/05 03:54 PM
Joined: Dec 2002
Posts: 3,534
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,534
Woops, my apologies!

Well this seems to work, thus far.

Code:
On *:Start: {
  var %x = $lines(database.txt)
  while (%x) {
    ignore $gettok($read(database.txt,%x),5,32)
    dec %x
  }
}

dialog database {
  title "database"
  size -1 -1 66 116
  option dbu
  list 1, 3 14 60 80, size
  button "Add", 2, 11 96 15 8
  button "Del", 3, 38 96 15 8
  button "Close", 4, 4 106 55 8
  edit "", 5, 3 2 60 10
}

On *:Dialog:database:init:0: {
  if ($lines(database.txt) >= 1) { .play -s database.txt 10 }
}

On *:Dialog:database:sclick:2: {
  if ($did(5)) {
    if ($read(database.txt,w,did -a database 1 $did($dname,5))) { echo -a $did(5) already exists. | halt }
    did -a $dname 1 $did(5)
    write database.txt did -a database 1 $did($dname,5)
    echo -a Added $+($did($dname,5),.)
  }
}

On *:Dialog:database:sclick:3: {
  if ($did(1).sel) {
    write -dw $+("*,$did(1,$did(1).sel),*") database.txt
    did -d $dname 1 $did(1).sel
  }
}

On *:Dialog:database:sclick:4: {
  dialog -x database database
}

Last edited by SladeKraven; 04/04/05 03:55 PM.
#116365 04/04/05 04:06 PM
T
The_Only
The_Only
T
Thanks smile

#116366 04/04/05 04:07 PM
Joined: Dec 2002
Posts: 3,534
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,534
You're welcome. smile

#116367 04/04/05 04:12 PM
T
The_Only
The_Only
T
Oh and by the way... is there a way not to add the network i'm logged on to when ignoring? Cause when I type "/ignore -pcntdik *!*@whatever.com" it also adds the network I'm logged on to in the Address Book.

#116368 04/04/05 04:18 PM
Joined: Dec 2002
Posts: 3,534
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,534
Sorry mate I'm a little tired, so I'm having trouble understanding hehe. Do you want the ignore to function on all networks?

#116369 04/04/05 04:29 PM
T
The_Only
The_Only
T
Am... so when you log on to a server to chat, and when you tipe "/ignore -pcntdik *!*@blablabla.bla" it ignores that Host/IP right? And when you go to the Address Book -> Control -> Ignore you can see "*!*@blablabla.bla" added with parameters "pcntdik" (private, ctcp etc.) but you can also see the network group/server address you were logged on to or to when ignoring. That makes the ignore valid only on this server/group. So I want to ignore someone with the /ignore command without adding the network/server address. Is it possible?

Sorry for explaining it like that but it will make it easier for you to understand me smile

#116370 04/04/05 04:33 PM
Joined: Dec 2002
Posts: 3,534
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,534
/ignore -w <Host/IP>

#116371 04/04/05 04:37 PM
T
The_Only
The_Only
T
LOL! Looks like I have to re-read the mirc help file about ignore again :P It seems i've missed it the last time I read it smile

Thanks again for everything smile

#116372 04/04/05 04:39 PM
Joined: Dec 2002
Posts: 3,534
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,534
Hehe, you're welcome smile


Link Copied to Clipboard