|
Joined: Aug 2004
Posts: 42
Ameglian cow
|
OP
Ameglian cow
Joined: Aug 2004
Posts: 42 |
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?
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
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.
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
}
|
|
|
|
Joined: Aug 2004
Posts: 42
Ameglian cow
|
OP
Ameglian cow
Joined: Aug 2004
Posts: 42 |
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?
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
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.
|
|
|
|
Joined: Aug 2004
Posts: 42
Ameglian cow
|
OP
Ameglian cow
Joined: Aug 2004
Posts: 42 |
by the way... sorry it wasn't a combo box  list 4, 7 50 134 154, size extsel vsbar A list box... Sorry
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Ok, well I've added an edit control and a list to make it look like a combo hehehe...
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
}
|
|
|
|
Joined: Aug 2004
Posts: 42
Ameglian cow
|
OP
Ameglian cow
Joined: Aug 2004
Posts: 42 |
Thanks pal  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.
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
You're welcome mate. 
|
|
|
|
Joined: Aug 2004
Posts: 42
Ameglian cow
|
OP
Ameglian cow
Joined: Aug 2004
Posts: 42 |
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,
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Woops, my apologies! Well this seems to work, thus far.
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.
|
|
|
|
Joined: Aug 2004
Posts: 42
Ameglian cow
|
OP
Ameglian cow
Joined: Aug 2004
Posts: 42 |
Thanks 
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
You're welcome. 
|
|
|
|
Joined: Aug 2004
Posts: 42
Ameglian cow
|
OP
Ameglian cow
Joined: Aug 2004
Posts: 42 |
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.
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Sorry mate I'm a little tired, so I'm having trouble understanding hehe. Do you want the ignore to function on all networks?
|
|
|
|
Joined: Aug 2004
Posts: 42
Ameglian cow
|
OP
Ameglian cow
Joined: Aug 2004
Posts: 42 |
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 
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
|
|
|
|
Joined: Aug 2004
Posts: 42
Ameglian cow
|
OP
Ameglian cow
Joined: Aug 2004
Posts: 42 |
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  Thanks again for everything 
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Hehe, you're welcome 
|
|
|
|
|