Url and Email Addresses — File Browser

UrlandEmailAddressesv1.2 / UrlandEmailAddressesv1.2 / alist / alist.mrc

alist.mrc — 10.24 KB — Download this file

;Url and Email Address v1.2 - by da^hype (da-hyp@hirc.org)
;website: http://www.hirc.org
;Malaysian Made

alias -l pop tokenize 32 $dll($pdll.alist,Popup,$1-) | if ($isid) return $1- | $iif($4- != did not select a menu item,$4-)
alias -l popup return $shortfn($scriptdirdll\popups.dll)
alias -l pdll.alist { return $+(",$scriptdirdll\popups.dll,") }
alias -l alist.error { dialog -m alist.error alist.error | did -f alist.error 2 | did -ra alist.error 1 $1- }
alias -l views.alist { return $scriptdirdll\views.mdx }
alias -l mdx.alist { return $+(",$scriptdirdll\mdx.dll,") }
alias -l `b.i.f { if ($isfile($+(",$scriptdirsettings.ini,")) == $true) return $readini $+(",$scriptdirsettings.ini,") $1 $2- }
alias -l `t.i.f { writeini $+(",$scriptdirsettings.ini,") $$1- }
alias -l ddll.alist { return $scriptdirdll\dialog.mdx }
alias -l alamat.error { dialog -m alamat.error alamat.error | did -f alamat.error 2 | did -ra alamat.error 1 $1- }
alias -l about.alamat { $iif(!$dialog(about.alamat),dialog -m about.alamat about.alamat) }
alias alist { $iif(!$dialog(alist),dialog -m alist alist) }
alias -l alist.find { $iif(!$dialog(alist.find),dialog -m alist.find alist.find) }
alias -l alamat.del { 
  if (!$`b.i.f(options,sort)) {
    write -dl $calc($did(1).sel - 1) $alamat | load_alamat 
  }
  else { alamat.error Please turn off sort before deleteing a url/email. }
}
alias -l alist.edit2 { 
  if ($did(1).sel == $null) {
    alamat.error You did not select a line to edit | halt 
  }
  elseif ($did(1).sel != $null) {
    set %alist.edit $calc($did(1).sel - 1) | alist.edit 
  } 
}
alias -l alist.edit { $iif(!$dialog(alist.edit),dialog -m alist.edit alist.edit) }
alias -l alist.unset { unset %alist.* }
alias -l alamat.copy { clipboard $gettok($did(1).seltext,11,32) }
alias -l `b.i.f { if ($isfile($+(",$scriptdirsettings.ini,"))) return $readini $+(",$scriptdirsettings.ini,") $1 $2- }
alias -l `t.i.f { writeini $+(",$scriptdirsettings.ini,") $$1- }
alias -l alamat.sort {
  if ($`b.i.f(options,sort)) { dll $mdx.alist SetControlMDX $dname 1 ListView headerdrag report rowselect showsel nosortheader sortascending single > $views.alist }
  if (!$`b.i.f(options,sort)) { dll $mdx.alist SetControlMDX $dname 1 ListView headerdrag report rowselect showsel nosortheader single > $views.alist }
}
alias -l alamat.go {
  var %n = $gettok($did(1).seltext,11,32)
  if (*@* iswm %n) { .run mailto: $+ %n }
  elseif (HTTP* iswm %n) { .url -n %n }
  else { alamat.error Go Button only works for ulr's or emails. }
}
alias -l alamat { return $+(",$scriptdiraddress.txt,") }
alias -l alamat.clear { write -c $+(",$scriptdiraddress.txt,") | load_alamat }
alias -l tambah_add {
  var %add = $?="Address?"
  var %adddes = $?="Description?"
  if (!$read($alamat,w,* $+ %add $+ *)) {
    write $alamat $date $+ $chr(149) $+ %add $+ $chr(149) $+ %adddes
    load_alamat
  }
  else { alamat.error Address or Description Already Exists. }
}
alias -l load_alamat {
  did -r alist 1
  var %a = 1
  while (%a <= $lines($alamat)) {
    did -a alist 1 $gettok($read($alamat,%a),1,149) $chr(9) $gettok($read($alamat,%a),2,149) $chr(9) $gettok($read($alamat,%a),3,149)
    inc %a
  }
}
dialog alamat.error {
  title "Error"
  size -1 -1 107 45
  option dbu
  icon $scriptdiricons\error.ico
  icon 2, 3 5 32 32, " $+ $scriptdiricons\error.ico $+ "
  text "null", 1, 20 8 85 20, center
  button "", 4, 75 30 30 12, ok
}
dialog about.alamat {
  title "About..."
  size -1 -1 150 128
  icon $scriptdiricons\alist.ico
  button Ok,1, 170 95 75 25,ok hide default
  box About Address Book,2, 5 5 290 8
  box "",3, 5 170 240 8
  text Author:,7, 10 25 50 20
  text Version:,8, 10 45 50 20
  text URL:,9, 10 65 50 20
  text v1.2,12, 60 45 50 20
  link darth^maul,10, 60 25 70 20
  link www.hirc.org,11, 60 65 80 20
  link Malaysian Made,13, 10 97 80 20
}
on *:dialog:about.alamat:sclick:*:{
  if ($did == 5) || ($did == 11) { url -n http://www.hirc.org }
  if ($did == 10) { run mailto:da-hype@hirc.org?subject=Addresses v1.2. }
  if ($did == 13) { url http://www.hirc.org/malaysia.html }
}
dialog alist {
  title "Url and Email Addresses v1.2 [ /alist ]"
  size -1 -1 231 129
  option dbu
  icon $scriptdiricons\alist.ico
  list 1, 2 2 227 115, size
  menu "&File" 100
  item "&Exit", 103 100
  menu "&View" 200
  item "&Sort", 201 200
  menu "&Help" 300
  item "&ReadMe", 301 300
  item "Break", 302 300
  item "&About", 303 300
  button "positioner",1000,0 0 0 0
}
on *:dialog:alist:menu:*: {
  if ($did == 103) { dialog -x alist }
  if ($did == 201) { 
    $iif($`b.i.f(options,sort),`t.i.f options sort 0,`t.i.f options sort 1) 
    if ($`b.i.f(options,sort)) { did -c alist 201 | if ($?!="Apply Changes Now?" == $true) { dialog -x alist | alist } }
    if (!$`b.i.f(options,sort)) { did -u alist 201 | if ($?!="Apply Changes Now?" == $true) { dialog -x alist | alist } }
  }
  if ($did == 301) { run $+(",$scriptdirreadme.html,") }
  if ($did == 303) { about.alamat }
}
on *:dialog:alist:init:*: {
  dll $mdx.alist SetMircVersion $version 
  dll $mdx.alist MarkDialog $dname
  dll $mdx.alist SetControlMDX $dname 1000 positioner minbox maxbox size > $ddll.alist
  alamat.sort
  did -i $dname 1 1 headerdims 70 215 230
  did -i $dname 1 1 headertext Date $chr(9) Address $chr(9) Description
  $iif($`b.i.f(options,sort),did -c alist 201,did -u alist 201)
  load_alamat
}
on *:load: { 
  if ($version >= 6.0) { echo -s Welcome to 4Url and Email Addresses v1.2 by da^hype | echo -s contact: da^hype@hirc.org | echo -s website: http://www.hirc.org | echo -s Malaysian Made | alist
  }
  else { echo -a Sorry, you can't use This Script with version $version of mIRC, get the latest version at http://www.mirc.com/ | .unload -rs alist\alist.mrc }
}
on *:dialog:alist:sclick:*: {
  if ($did == 1) {
    if ($gettok($did($dname,1,1),1,32) != rclick) halt
    dll $popup New alamat 16 16
    dll $popup LoadImg alamat icon small $scriptdiricons\add.ico
    dll $popup LoadImg alamat icon small $scriptdiricons\del.ico
    dll $popup LoadImg alamat icon small $scriptdiricons\edit.ico
    dll $popup LoadImg alamat icon small $scriptdiricons\copy.ico
    dll $popup LoadImg alamat icon small $scriptdiricons\fav.ico
    dll $popup LoadImg alamat icon small $scriptdiricons\find.ico
    dll $popup LoadImg alamat icon small $scriptdiricons\clear.ico
    dll $popup AddItem alamat end 1 1 &Add $cr tambah_add
    dll $popup AddItem alamat end $iif($did(1).sel != $null,+,+d) 2 2 &Del $cr alamat.del
    dll $popup AddItem alamat end
    dll $popup AddItem alamat end $iif($did(1).sel != $null,+,+d) 3 3 &Edit $cr alist.edit2
    dll $popup AddItem alamat end $iif($did(1).sel != $null,+,+d) 4 4 &Copy $cr alamat.copy
    dll $popup AddItem alamat end $iif($did(1).sel != $null,+,+d) 5 5 &Go $cr alamat.go
    dll $popup AddItem alamat end 6 6 &Find $cr alist.find
    dll $popup AddItem alamat end
    dll $popup AddItem alamat end 7 7 C&lear All $cr alamat.clear
    pop alamat $mouse.dx $mouse.dy
  }
  if ($did == 1000) {
    if ($gettok($did(1000,1),1,32) != size) { halt }
    did -i $dname 1 1 headerdims 70 215 $calc($dialog($dname).w - 180)
    dll $mdx.alist MoveControl $dname 1 * * $calc($dialog($dname).w - 16) $calc($dialog($dname).h - 62)
  }
}
on *:dialog:alamat.error:init:*: {
  dll $mdx.alist SetMircVersion $version 
  dll $mdx.alist MarkDialog $dname
  dll $mdx.alist SetFont $dname 1 +a 12 900 verdana
  did -a $dname 4 &Ok
}
menu menubar,channel {
  Addresses
  .Setup:alist
  .ReadMe:run $+(",$scriptdirreadme.html,")
  .-
  .Uninstall { 
    if ($?!="Continue with uninstall?" == $true) { 
      echo -a *** Unloading...
      echo -a *** Done...
      .unload -rs $+(",$script,")
    }
  }
}
on *:dialog:alist:dclick:*:{  if ($did == 1) alamat.go } 
dialog alist.find {
  title "Search"
  icon $scriptdiricons/find.ico
  size -1 -1 130 46
  option dbu
  box "", 1, 2 1 126 28
  text "Find text:", 2, 12 12 30 13
  edit "", 3, 42 10 80 12, multi return
  button "&Find", 7, 48 32 40 12,default
  button "&Cancel", 6, 88 32 40 12, cancel
}
on *:dialog:alist.find:sclick:*:{
  if $did = 7 {
    %quote.alist.tmp2 = $did(3)
    set %alist.tmp * $+ $did(3) $+ *
    var %alist.tmp2 = $alamat
    var %alist.tmp = $read(%alist.tmp2, wn, %alist.tmp, %alist.count)
    %alist.count = $calc($readn + 1)
    did -c alist 1 %alist.count
    did -f alist 1
    did -a alist.find 7 &Find Next
  }
}
on *:dialog:alist.find:close:*:{ unset %alist.* }
on *:dialog:alist:close:*:{ $iif($dialog(alist.find),dialog -x alist.find) }
dialog alist.edit {
  title "Edit"
  size -1 -1 150 63
  option dbu
  icon $scriptdir\icons\edit.ico
  button "&Ok",1, 115 50 30 12, default ok
  button "&Cancel",11, 85 50 30 12, cancel
  box "", 2, 3 3 144 42
  edit "", 3, 42 12 100 11, autohs
  edit "", 4, 42 28 100 11, autohs
  text "", 7, 10 14 30 11
  text "Description", 8, 10 30 30 11
}
on *:dialog:alist.edit:init:*: {
  dll $mdx.alist SetMircVersion $version 
  dll $mdx.alist MarkDialog $dname
  dll $mdx.alist SetFont $dname 2 +a 15 900 verdana
  set %alist.url $gettok($read($alamat,%alist.edit),2,149)
  set %alist.desc $gettok($read($alamat,%alist.edit),3,149)
  if (*@* iswm %alist.url) { did -a $dname 2 Edit Email | did -a $dname 7 Email }
  elseif (HTTP* iswm %alist.url) { did -a $dname 2 Edit Url | did -a $dname 7 Url }
  did -a $dname 3 %alist.url
  did -a $dname 4 %alist.desc

}
on *:dialog:alist.edit:edit:*: {
  set %alist.url $did(3).text
  set %alist.desc $did(4).text
}
on *:dialog:alist.edit:close:*: alist.unset 
on *:dialog:alist.edit:sclick:1: {
  if (%alist.url == $null) || (%alist.desc == $null) { 
    alamat.error You left a field empty. | halt 
  }
  elseif (*#* iswm %alist.url) || (*;* iswm %alist.url) || (*$* iswm %alist.url) || (*&* iswm %alist.url) { 
    alamat.error Can't add simbols in url/email. $chr(40) $+ %alist.desc $+ $chr(41) | halt 
  }
  elseif (*#* iswm %alist.desc) || (*;* iswm %alist.desc) || (*$* iswm %alist.desc) || (*^* iswm %alist.desc) || (*&* iswm %alist.desc) { 
    alamat.error Can't add simbols in description(s). $chr(40) $+ %alist.desc $+ $chr(41) | halt 
  }
  else { 
    write -l %alist.edit $alamat $date $+ $chr(149) $+ %alist.url $+ $chr(149) $+ %alist.desc
    alist.unset
  }
  load_alamat
}