DCC Control — File Browser

DCCControlv1.2 / DCCControlv1.2 / dialogdcc.mrc

dialogdcc.mrc — 8.62 KB — Download this file

;%%%%%%%%%%%%%%%%%%%%%%%%
;script DCC Control
;version 1.2rc4
;author facts
;email jfacts1731@telocity.com
;url none
;%%%%%%%%%%%%%%%%%%%%%%%%

alias -l rd.in { if ($2 != $null) { return $readini -n $scriptdirdcc.ini $1 $2 } }
alias -l wr.in { if ($3 != $null) { writeini -n $scriptdirdcc.ini $1 $2 $3- } }
alias -l del.in { if ($2 != $null) { remini $scriptdirdcc.ini $1 $2 } }
alias -l dcc.off { wr.in misc dcc.enabled 0 }
alias -l dcc.on { wr.in misc dcc.enabled 1 }
alias -l dcc.setoptions { dialog -m dcc.options dcc.options }
alias -l dcc.seticon { dialog -m dcc.iconchoose dcc.iconchoose }
alias -l dcc.error { set %dcc.error $1- | $dialog(dcc.error,dcc.error,-4) | halt }
alias -l dcc.xdialog { 
    if ($dialog($1) == $null) { halt } 
  dialog -x $1 
}  
alias -l dcc.check {
  set %dcc.readini $rd.in(icons,%dcc.extension)
  if (%dcc.readini != $null) {
    did -g dcc- $+ %dcc.fn 3 $rd.in(icons,%dcc.extension)
  }
}
; dcc.sclick inisection did
alias -l dcc.sclick {
  var %dcc.tmp1 = $1
  var %dcc.tmp2 = $2
  var %dcc.tmp3 = $rd.in(options,%dcc.tmp1)
  if (%dcc.tmp3 == 1) {
    did -u dcc.options $2
    wr.in options %dcc.tmp1 0
  }
  if (%dcc.tmp3 != 1) {
    did -c dcc.options %dcc.tmp2
    wr.in options %dcc.tmp1 1
  }
}
; dcc.checked did dialogname inisection
alias -l dcc.checked {
  var %dcc.tmp1 = $1
  var %dcc.tmp2 = $2
  var %dcc.tmp3 = $3
  var %dcc.did1 = $did(%dcc.tmp2,%dcc.tmp1).state
  if (%dcc.did1 == 0) {
    wr.in options %dcc.tmp3 0
  }
  if (%dcc.did1 == 1) {
    wr.in options %dcc.tmp3 1
  }
}
on *:LOAD: { if ($version < 5.61) { 
    echo -at 2*** You need mIRC 5.61 or higher to run this script.  
    unload -rs $script 
    halt 
  }
  dcc.on  
  echo -at 2*** Thank You for Trying DCC Control 1.0rc3.
  echo -at 2*** by facts: jfacts1731@telocity.com.
  echo -at 2*** Set your options now.
  dcc.setoptions 
} 

menu menubar {
  .-
  DCC Control
  .$iif($rd.in(misc,dcc.enabled) != 1,&Enable Dcc Capture): dcc.on
  .$iif($rd.in(misc,dcc.enabled) == 1,&Disable Dcc Capture): dcc.off
  .&Configure Icons: dcc.seticon
  .Set &Options: { dcc.setoptions }
  .&Set Archive Dir: {
    wr.in misc archivedir $sdir($mircdir,Select a Directory)
  }
  .&Uninstall: {
    if ($?!="Do you want to uninstall Dcc Control?" != $false) {
      if ($dialog(dcc.error)) { dialog -x dcc.error dcc.error }
      if ($dialog(dialogdcc)) { dialog -x dialogdcc dialogdcc }
      if ($dialog(dcc.iconchoose)) { dialog -x dcc.iconchoose dcc.iconchoose } 
      unset %dcc.*
      .unload -rs $script
      halt
    }
  }
}
dialog dcc.main {
  title "File Recieved"
  size -1 -1 116 60
  option dbu
  text "" 2, 28 13 63 13, Center
  icon 3, 12 13 16 16, mirc32.exe, 1, mirc32.exe, 1
  button "Open" 4, 10 40 22 13,
  button "Delete" 5, 34 40 22 13,
  button "Copy" 6, 60 40 22 13,
  button "Cancel" 7, 85 40 22 13, Cancel
  text "" 8, 20 20 20 20, hide
}

dialog dcc.iconchoose {
  title "Setup Icons"
  size -1 -1 133 89
  option dbu
  combo 2, 10 10 57 72,
  icon 3, 90 5 29 30,
  button "+" 4, 70 10 13 10,
  button "-" 5, 70 20 13 10,
  button "Return" 6, 80 65 46 13, Ok
  text "Enter Extension Here" 7, 0 0 68 7, Center
}
dialog dcc.error {
  title "Error"
  size -1 -1 134 37
  option dbu
  button "Ok" 2, 45 23 42 12, Ok
  text "" 3, 5 5 125 15, Center
}

dialog dcc.options {
  title "Options"
  size -1 -1 133 115
  option dbu
  text "DCC Control 1.0rc3 by facts" 1, 4 84 69 9, Disable
  button "Ok" 2, 37 97 37 13, Ok
  box "" 3, 3 10 121 84,
  text "On DCC Finish (all files)" 4, 27 16 64 9, Center
  check "" 5, 9 34 10 10,
  text "Close Finished DCC Get Window" 6, 19 35 79 10,
  check "" 7, 9 45 10 10,
  text "Open File" 8, 19 46 27 10,
  check "" 9, 9 55 10 10,
  text "Copy File To Archive" 10, 19 56 55 10,
  check "" 11, 9 66 10 10,
  text "Close DCC Control window After x Min" 12, 19 68 73 17,
  edit "" 13, 96 66 21 10,
  check "" 23, 9 24 10 10,
  text "Log DCCs" 24, 19 25 27 10,
  button "empty" 25, 100 100 10 10, Default hide
}

on *:dialog:dcc.options:init:0: {
  if ($rd.in(options,allclosefinish) == 1) { did -c $dname 5 }
  if ($rd.in(options,allopenfile) == 1) { did -c $dname 7 }
  if ($rd.in(options,allcopytoarchive) == 1) { did -c $dname 9 }
  if ($rd.in(options,allclosedialogtime) == 1) { did -c $dname 11 }
  if ($rd.in(options,allclosedialog) != 1) { did -m $dname 13 }
  if ($rd.in(options,alllogdcc) == 1) { did -c $dname 23 }
  var %dcc.tmp1 = $rd.in(options,alltimeclose) 
  if (%dcc.tmp1 != $null) { 
    did -a $dname 13 %dcc.tmp1
  }
}
on *:dialog:dcc.options:*:*: { 
  if ($devent == sclick) && ($did == 11) { 
    if ($rd.in(misc,13) != 1) {
      did -n $dname 13
      wr.in misc 13 1
    }
    else {
      wr.in misc 13 0
      did -m $dname 13 
    }
  }
  if ($devent == sclick) && ($did == 2) {
    dcc.checked 5 $dname allclosefinish
    dcc.checked 7 $dname allopenfile
    dcc.checked 9 $dname allcopytoarchive 
    dcc.checked 11 $dname allclosedialogtime
    dcc.checked 23 $dname alllogdcc
    if ($did($dname,13) !isnum 1-60) && ($did($dname,11).state == 1) {
      did -r $dname 13      
      dcc.error Error: You must give amount of time in minutes (1-60) box if checked.
    }
    if ($did($dname,11).state == 1) { wr.in options alltimeclose $did($dname,13) }
  }
}

on *:DIALOG:dcc.error:init:0: {
  did -a dcc.error 3 %dcc.error
}
on *:DIALOG:dcc-*:init:0: {
  dcc.check
  did -a $dname 2 %dcc.fn
  did -a $dname 8 %dcc.rn
  unset %dcc.fn
  unset %dcc.rn
} 
on *:DIALOG:dcc-*:sclick:4: {
  run " $+ $did($dname,8) $+ "
  dialog -x $dname
}
on *:DIALOG:dcc-*:sclick:5: {
  if ($?!="Are you sure you want to delete this file?" == $true ) {  
    rem " $+ $did($dname,8) $+ "
    dialog -x $dname
  }
}
on *:DIALOG:dcc-*:sclick:6: {
  if ($len($rd.in(misc,archivedir)) < 1) {
    dcc.error Error: You have not selected an archive dir. Do so now from the menubar.
  }
  .copy %dcc.rn " $+ $rd.in(misc,archivedir) $+ "
  dialog -x $dname
}
on *:DIALOG:dcc.iconchoose:init:0: {
  var %dcc.i = 1
  var %dcc.totalicos = $ini($scriptdirdcc.ini,icons,0)
  while (%dcc.i <= %dcc.totalicos) {
    did -i dcc.iconchoose 2 %dcc.i $ini($scriptdirdcc.ini,icons,%dcc.i)
    inc %dcc.i
  }
}
on *:DIALOG:dcc.iconchoose:sclick:2: {
  var %dcc.sel = $did(dcc.iconchoose,2).text
  var %dcc.ico = $rd.in(icons,%dcc.sel)
  if ($exists(%dcc.ico)) {
    did -g dcc.iconchoose 3 %dcc.ico
  }
}
on *:DIALOG:dcc.iconchoose:dclick:2: {
  var %dcc.tmpico = $did($dname,2).sel
  var %dcc.tmpico2 = $did($dname,2)
  did -d $dname 2 %dcc.tmpico
  del.in icons %dcc.tmpico2
}
on *:DIALOG:dcc.iconchoose:sclick:4: {
  if ($did(dcc.iconchoose,2) == $null) { halt }
  var %dcc.perm = $did(dcc.iconchoose,2)
  if (*.* iswm %dcc.perm) { 
    dcc.error Error: Do not use . infront of extension.  Use txt instead of .txt.
  } 
  if ($didwm(dcc.iconchoose,2,%dcc.perm)) {
    %dcc.error Error: Extension already exists.
  }
  var %dcc.icos = $sfile($mircdir,Choose an icon. Must be .ico format.,Ok)
  if ($gettok(%dcc.icos,$numtok(%dcc.icos,46),46) != ico) {
    %dcc.error Error: You must select an .ico file.
  }
  did -a dcc.iconchoose 2 %dcc.perm
  wr.in icons %dcc.perm %dcc.icos
}
on *:DIALOG:dcc.iconchoose:sclick:5: {
  var %dcc.seled = $did(dcc.iconchoose,2).sel
  var %dcc.seled2 = $did(dcc.iconchoose,2).text
  if (%dcc.seled2 == $null) { halt }
  did -d dcc.iconchoose 2 %dcc.seled
  del.in icons %dcc.seled2
}
on *:FILERCVD:*: {
  if ($rd.in(misc,dcc.enabled) != 1) { halt }
  dcc.runoptions $nick $filename dcc- $+ $nopath($filename)
  set %dcc.rn $filename
  set %dcc.fn $nopath($filename) 
  if ($dialog(dcc- [ $+ [ %dcc.fn ] ] ) != $null) { dialog -x dcc- $+ %dcc.fn }
  set %dcc.extension $gettok(%dcc.fn,$numtok(%dcc.fn,46),46)
  dialog -m dcc- $+ %dcc.fn dcc.main 
}
; dcc.runoptions $nick $filename $dname
alias dcc.runoptions {
  if ($rd.in(options,allclosefinish) == 1) { close -g $1 }
  if ($rd.in(options,allopenfile) == 1) { run $2 }
  if ($rd.in(options,allclosedialogtime) == 1) { .timer $+ $3 1 $calc($rd.in(options,alltimeclose) * 60) dcc.xdialog $3 }
  if ($rd.in(options,alllogdcc) == 1) { .write $scriptdirdcclog.txt $2 recieved from $1 on $asctime(mm/dd/yy) at $asctime(hh:nn:ss TT) } 
  if ($rd.in(options,allcopytoarchive) == 1) { 
    if ($rd.in(misc,archivedir) == $null) { echo -a 2*** You have not set an archive dir. Do so now from the menubar. | halt }
    if ($exists($rd.in(misc,archivedir)) != $true) { echo -a 2*** Archive dir does not exist.  File will not be copied. | halt }
    copy $2 $rd.in(misc,archivedir) 
  }
}

on *:EXIT: { unset %dcc.* }