mIRC Home    About    Download    Register    News    Help

Print Thread
#201018 17/06/08 03:10 AM
Joined: Aug 2006
Posts: 44
D
Ameglian cow
OP Offline
Ameglian cow
D
Joined: Aug 2006
Posts: 44
here is the script:
Code:
dialog _dragon.dm {
  title "Download Manager"
  size -1 -1 210 254
  option dbu
  list 1, 5 5 200 150, size
  box "", 17, 2 -1 206 252
  text "Filename:", 4, 5 159 32 8, right
  edit "", 5, 40 158 165 10, read autohs
  text "Received:", 6, 5 169 32 8, right
  edit "", 7, 40 168 50 10, read autohs
  text "from:", 8, 90 169 32 8, right
  edit "", 9, 125 168 80 10, read autohs
  text "Path to file:", 15, 5 179 32 8, right
  edit "", 14, 40 178 165 10, read autohs
  text "File info:", 20, 5 189 32 8, right
  edit "", 2, 40 188 165 10, read
  button "&Open", 3, 5 200 37 12
  button "&Delete File", 13, 45 200 37 12
  button "&Move File", 11, 85 200 37 12
  button "Ren&ame", 12, 125 200 37 12
  button "&Clear List", 10, 165 200 37 12
  check "Open Download Manager when Download is complete", 18, 30 215 145 8
  button "&Ok", 19, 65 235 37 12, ok
  button "Ca&ncel", 16, 105 235 37 12, cancel
  check "Replace _ with a space when Download is complete", 21, 30 223 145 10
}
alias -l init {
  set %_dragon.dm.w 14
  .timerdragon.dm.w -m 0 1 dragon.dm.w %_dragon.dm.w
}
alias -l dragon.dm.w {
  if ((!$dialog(_dragon.dm)) || (%_dragon.dm.w >= 425)) { .timerdragon.dm.w off | %_dragon.dm.h = $1 | .timerdragon.dm.h -m 0 1 dragon.dm.h $1 | return }
  x.y | dialog -s _dragon.dm %_dragon.dm.x %_dragon.dm.y %_dragon.dm.w 0
  inc %_dragon.dm.w $1
}
alias -l dragon.dm.h {
  if ((!$dialog(_dragon.dm)) || (%_dragon.dm.h >= 515)) { .timerdragon.dm.h off | unset %_dragon.dm.? | return }
  x.y | dialog -s _dragon.dm %_dragon.dm.x %_dragon.dm.y $calc(%_dragon.dm.w - $1) %_dragon.dm.h
  inc %_dragon.dm.h $1
}
alias -l x.y {
  %_dragon.dm.x = $int($calc(($window(-1).w / 2) - ($dialog(_dragon.dm).w /2)))
  %_dragon.dm.y = $int($calc(($window(-1).h / 2) - ($dialog(_dragon.dm).h /2)))
}
on *:filercvd:*:{ down -a $nick $address $ctime $filename }
on *:dialog:_dragon.dm:init:0:{
  down -c 
  if ($hget(_dragon.dm,aopen)) { did -c _dragon.dm 18 }
  if ($hget(_dragon.dm,rename)) { did -c _dragon.dm 21 }
}
on *:dialog:_dragon.dm:sclick:19:{ down -s }
on *:dialog:_dragon.dm:sclick:1:{ -show }
on *:dialog:_dragon.dm:sclick:3:{ open }
on *:dialog:_dragon.dm:dclick:1:{ open }
on *:dialog:_dragon.dm:sclick:13:{ delete | -show }
on *:dialog:_dragon.dm:sclick:11:{ move }
on *:dialog:_dragon.dm:sclick:12:{ rename }
on *:dialog:_dragon.dm:sclick:10:{ if ($did(_dragon.dm,1,1)) { $-yesno(Are you sure to remove all files from the List? $+ $str($crlf,3) $+ Note: Files won't be removed from HDD.,clearlist) } }
alias down {
  foldercheck
  if (!$hget(_dragon.dm)) { hmake _dragon.dm | hload _dragon.dm tmp\settings }
  if ($1 == -a) {
    if ($hget(_dragon.dm,rename)) {
      if (!$exists($replace($5-,_,$chr(32)))) {
        !.rename $+(",$5-," ",$nofile($5-),$replace($nopath($5-),_,$chr(32)),")
        tokenize 32 $1-4 $replace($5-,_,$chr(32)) 
      }
    }
    if ($hget(_dragon.dm,aopen)) { dialog $+(-,$iif(!$dialog(_dragon.dm),m,v)) _dragon.dm _dragon.dm | init }
    if ($read(tmp\files,nw,$5-)) {
      var %x = $readn
      write -dl $+ %x tmp\files
      write -dl $+ %x tmp\info
    }
    write tmp\files $5- | write tmp\info $2-
    .timer 1 0 down -c
  }
  elseif ($1 == -c) {
    if ($dialog(_dragon.dm)) {
      did -r _dragon.dm 1
      loadbuf -o _dragon.dm 1 tmp\files
      did -z _dragon.dm 1
    }
  }
  elseif ($1 == -s) {
    hadd -m _dragon.dm aopen $did(_dragon.dm,18).state
    hadd -m _dragon.dm rename $did(_dragon.dm,21).state
    hsave _dragon.dm tmp\settings
  }
  else { dialog $+(-,$iif(!$dialog(_dragon.dm),m,v)) _dragon.dm _dragon.dm | init }
}
alias -l clearlist { foldercheck | did -r _dragon.dm 1,2,5,7,9,14 | write -c tmp\files | write -c tmp\info }
alias -l -yesno { if ($input($1,adiyg,mIRC Download Manager)) { $2 } }
alias -l -error { $left($input($1-,adiog,mIRC Download Manager),0) }
alias -l rename {
  if ($exists($did(_dragon.dm,1).seltext)) { 
    var %x = $did(_dragon.dm,1).seltext,%np = $nofile(%x) $+ $$input(The new Filename for $nopath(%x) $+ :,doe,DCVCD Download Manager,$nopath(%x))
    if (%np !== %x) {
      if ($exists(%np)) { $-yesno(The file: $+ $str($crlf,2) $+ %np $str($crlf,2) $+ does already exists. $+ $crlf $+ Do you want to overwrite it?,!.remove $+(",%np,")) }
      if (!$exists(%np)) {
        !.rename $+(",%x," ",%np,")
        foldercheck
        if ($read(tmp\files,nw,%x)) {
          var %y = $readn
          var %ol = $read(tmp\info,nw,& & & %x)
          write -dl $+ %y tmp\files
          write -dl $+ %y tmp\info
        }
        write tmp\files %np
        write tmp\info $gettok(%ol,1-3,32) %np
        down -c | -show
      }
    }
  }
  elseif $did(_dragon.dm,1).seltext { -error $+(The file:,$str($crlf,2),$did(_dragon.dm,1).seltext,$str($crlf,2),doesn't exists!) }
  elseif $did(_dragon.dm,1,1) { -error You should select a file at first. }
}
alias -l move {
  if ($exists($did(_dragon.dm,1).seltext)) { 
    var %x = $did(_dragon.dm,1).seltext,%np = $+($$sdir($nofile(%x),Select the Path where to save your " $+ $nopath(%x) $+ "),$nopath(%x))
    if (%np != %x) {
      if ($exists(%np)) { $-yesno(The file: $+ $str($crlf,2) $+ %np $str($crlf,2) $+ does already exists. $+ $crlf $+ Do you want to overwrite it?,!.remove $+(",%np,")) }
      if (!$exists(%np)) {
        !.rename $+(",%x," ",%np,")
        foldercheck
        if ($read(tmp\files,nw,%x)) {
          var %y = $readn
          var %ol = $read(tmp\info,nw,& & & %x)
          write -dl $+ %y tmp\files
          write -dl $+ %y tmp\info
        }
        write tmp\files %np
        write tmp\info $gettok(%ol,1-3,32) %np
        down -c | -show
      }
    }
  }
  elseif $did(_dragon.dm,1).seltext { -error $+(The file:,$str($crlf,2),$did(_dragon.dm,1).seltext,$str($crlf,2),doesn't exists!) }
  elseif $did(_dragon.dm,1,1) { -error You should select a file at first. }
}
alias -l open {
  if ($exists($did(_dragon.dm,1).seltext)) { 
    run $did(_dragon.dm,1).seltext
    goto s
    :error
    if ($version > 6.13) {
      reseterror
      $-yesno(Can't open this File $+ $chr(44) this file is not a registered filetype of Windows $+ $chr(44) do you want to load the file into notepad?,run notepad $did(_dragon.dm,1).seltext)
    }
    :s
  } 
  elseif $did(_dragon.dm,1).seltext { -error $+(The file:,$str($crlf,2),$did(_dragon.dm,1).seltext,$str($crlf,2),doesn't exists!) }
  elseif $did(_dragon.dm,1,1) { -error You should select a file at first. }
}
alias -l delete {
  var %x = $did(_dragon.dm,1).sel
  if ($exists($did(_dragon.dm,1).seltext)) { $-yesno(Are you sure to remove the file: $+ $crlf $+ $did(_dragon.dm,1).seltext,!.remove " $+ $did(_dragon.dm,1).seltext $+ ") | -show } 
  if ($did(_dragon.dm,1).sel) && (!$exists($did(_dragon.dm,1).seltext)) {
    write -dl $+ $did(_dragon.dm,1).sel tmp\files
    write -dl $+ $did(_dragon.dm,1).sel tmp\info
    down -c
    if ($did(_dragon.dm,1,%x)) { did -c _dragon.dm 1 %x }
    elseif ($calc($did(_dragon.dm,1,%x) - 1)) { did -c _dragon.dm 1 $calc(%x - 1) }
  }
}
alias -l -show {
  foldercheck
  did -r _dragon.dm 2,5,7,9,14
  if ($did(_dragon.dm,1).seltext) {
    var %x = $ifmatch
    tokenize 32 $read(tmp\info,nw,& & & %x)
    did -a _dragon.dm 5 $nopath(%x)
    did -a _dragon.dm 7 $asctime($3,dd.mm.yy - HH:nn)
    did -a _dragon.dm 9 $1 ( $+ $2 $+ )
    did -a _dragon.dm 14 $nofile($4-)
    if ($exists($4-)) {
      did -a _dragon.dm 2 Size: $bytes($file($4-).size).suf - Modified: $asctime($file($4-).mtime,dd.mm.yy - HH:nn)
    }
    else { did -a _dragon.dm 2 File has been removed, has been moved or renamed. }
  }
}
alias -l foldercheck {
  if (!$isdir(tmp)) { mkdir tmp }
  if (!$exists(tmp\settings)) { write -c tmp\settings }
  if (!$exists(tmp\files)) { write -c tmp\files }
  if (!$exists(tmp\info)) { write -c tmp\files }
}

menu channel {
  -  
  Download Manager: /dialog -m _dragon.dm _dragon.dm
  -
}


1st issue: i am trying to get this to animate while opening and it is not.

2nd issue: it does not seem to delete the files when you click on delete.

any help with these two issues is greatly apprecaited.

Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
I have looked at this dialog as per acknowledgement of what I see everything should work as mentioned for deleting, as even the removal process has "" (quotes). The only thing I would think that would prevent you deleting anything is an invalid CHR recongnize by the script has a script command. (I would remove the . before remove in the delete portition of your script and then look in your status window when you click on delete) should give you a verbose of what is actually happening. I even double checked the local alias delete and ran a test and it deletes the file from list. What im wondering is the files you are downloading do they start with a _ im not clear of what you wrote on top yet but it seems your adding a _ in the list now if that's the case and you click on delete it will delete the file from the list but won't delete from the HDD since the string does not match.

As for animate what do you mean by this? Do you wish your dialog to open a certain way or load your hash file into the list?


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }

Link Copied to Clipboard