MIRC Phone Book

By Tweek on Jun 05, 2011

Screenshots

Phone book in MIRC i thought might be usefull. Again wraith did help me code but i did the rest.

Alias DD2 {
  dialog -mdo DD2 DD2
}
dialog DD2 {
  title "Dialog"
  icon icons\264.ico, 0
  size -1 -1 327 205
  option pixels notheme
  list 1, 1 27 325 100
  edit "", 2, 1 109 325 54, vsbar center
  button "Add", 3, 3 162 65 25
  button "Remove", 4, 72 162 65 25
  button "Close", 11, 208 161 65 25
  text "By Justin AKA Tweek", 7, 92 188 153 17, center
  text "Phone Number's", 8, 113 11 100 17, center
  text "Names", 9, 12 11 100 17, center
  text "Address", 10, 215 11 100 17, center
}
On *:Dialog:DD2:*:*:{
  if ($devent == InIt) { 
    dd2.read
  }
  If ($devent == Sclick) {
    If ($did = 3) {
      write DD2.txt $did(2)
      Did -a $dname 1 $did(2) 
    }
    if ($did = 11) {
      dialog -x $dname $dname
    }
    If ($did = 4) {
      Write -dl $+ $did(1).sel dd2.txt
      did -d $dname 1 $did(1).sel
    }
  }
}
Alias dd2.read {
  var %x 1
  While (%x <= $lines(dd2.txt)) {
    Did -a DD2 1 $Read(DD2.txt,%x)
    Inc %x
  }
}
Sign in to comment.
napa182   -  Jun 05, 2011

also for ur close button no need to do

if ($did = 11) {
      dialog -x $dname $dname
    }

if you do ur button like so

button "Close", 11, 208 161 65 25, cancel

you can also do the open alias like this

Alias DD2 dialog $iif($dialog(DD2),-v,-mdo DD2) DD2

just so you dont get anyone bitching about a open error

you should as well add some checks if anything is entered to add or remove so it wont error on that as well. Remember to add error checks when making a snippet. Think of any/everything that can an will go wrong with it. checks as in if name, phone number, and address is entered. when you say "Again wraith did help me code but i did the rest." what is the rest that you did, and what is the code wraith did? One more thing you may want to add a scroll bar cuz if you input all the info you cant read it all without scrolling. 4/10

 Respond  
Tweek   -  Jun 05, 2011

o ok yea ill do that... thanks

 Respond  
Jethro   -  Jun 05, 2011

I'm surprised he didn't know what I mean. Check out the help file for the filter command. The filter is supposed to work faster than looping through the $lines() with $read()

You can try it out and see for yourself if you're in doubt.

 Respond  
Tweek   -  Jun 05, 2011

ok that confused me lol i even asked writh and he dident know what you ment

 Respond  
Jethro   -  Jun 05, 2011

Tweek, you don't need the dd2.read alias with the while loop. Use the filter command and its -fo switch:

  if ($devent == InIt) && ($isfile(dd2.txt)) {
    filter -fo dd2.txt DD2 1
  }

Then you can remove the dd2.read alias, making your snippet a bit smaller and compact. Keep it up.

 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.