mIRC Home    About    Download    Register    News    Help

Print Thread
#111726 18/02/05 04:48 PM
Joined: Jan 2005
Posts: 75
Z
ztnaraM Offline OP
Babel fish
OP Offline
Babel fish
Z
Joined: Jan 2005
Posts: 75
I need this to list faster, i just freezes mIRC for ages, i think somehow i need it to write the tracks to a text file then list them, meanwhile this is what i have
Code:
alias mplist {
  var %len $calc($len(%mp3.dir) + 1) 
  did -r mp 4 
  did -r mp 35
  did -a mp 35 0 of $findfile(%mp3.dir,*.mp3,0, did -a mp 4  $remove($mid($1-,%len),.mp3)) 
  did -o mp 36 1 $mpsize
}   


it's just so slow confused

#111727 18/02/05 05:03 PM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
You should always store large amounts of files you need to use in a single file/hashtable/whatever.
If you have a lot of mp3s then a hashtable would be best, repeatedly accessing a single file can be slow as well, especially with $read instead of file handling commands. wink

* tidy_trax thinks a $findfilecall() (Like $dllcall() and $comcall() - multi-threaded) would be nice.


New username: hixxy
#111728 18/02/05 05:14 PM
Joined: Jan 2005
Posts: 75
Z
ztnaraM Offline OP
Babel fish
OP Offline
Babel fish
Z
Joined: Jan 2005
Posts: 75
It's strange, i just tried it on a blank mIRC 6.12, and it listed 3000 tracks in less than 5 seconds, mIRC 6.16 took a minute and a half, something drastic has changed crazy

#111729 18/02/05 05:44 PM
Joined: Jan 2005
Posts: 75
Z
ztnaraM Offline OP
Babel fish
OP Offline
Babel fish
Z
Joined: Jan 2005
Posts: 75
i've found the problem, it's not the listing, it's the the alias that's getting the size of the folder that is slowing it down.

Code:
alias mpsize {
  %mp3size = 0 
  var %temp $findfile(%mp3.dir,*.mp3,0,inc %mp3size $file($1-).size)) 
  return $round($calc(%mp3size / 1073741824),2) $+ gb
}  

#111730 19/02/05 04:05 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Code:
alias mplist {
  set -u %len $calc($len(%mp3.dir) + 1) 
  did -r mp 4 
  did -r mp 35
  set -u %mp3size 0 
  did -a mp 35 0 of $findfile(%mp3.dir,*.mp3,0, mpfile $1- ) 
  did -o mp 36 1 $round($calc(%mp3size / 1073741824),2) $+ gb
}

alias mpfile {
  did -a mp 4  $remove($mid($1-,%len),.mp3)
  inc %mp3size $file($1-).size)
}


Do both the jobs in one pass. This might help somewhat.

#111731 19/02/05 12:31 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Hi,

you could try this snippet, it gives my foldersize pretty instantly, no matter how many files, folder with 3500 files like my program files.

Usage: $foldersize(path to folder [,bkmgt3])

Path to folder does not have to contain quotes " ", does not have to contain a trailing slash, but can, and a second parameter is optional to show the unit of the format that you chose of the $bytes identifier. The default output is in bytes.

The output includes all the subfolders, and is actually the same function as when you right click in Explorer to see the size, being the filesystem object from windows.

Examples:

//echo -a $foldersize(c:\program files)
//echo -a $foldersize($mircdir,m)

Code:
alias foldersize {
  if !$exists($$1\) { echo -ac info $!foldersize: No such folder $1 | return }
  var %a = a $+ $ticks, %b = b $+ %a, %c = $2
  .comopen %a Scripting.FileSystemObject
  if !$comerr {
    .comclose %a $com(%a,GetFolder,1,bstr,$remove($1\,"),dispatch* %b)
    if $com(%b) {
      tokenize 32 $com(%b,Size,3) $com(%b).result
      .comclose %b
      return $iif(%c,$bytes($2,%c).suf,$2)
    }
  }
}


Gone.
#111732 19/02/05 01:21 PM
Joined: Jan 2005
Posts: 75
Z
ztnaraM Offline OP
Babel fish
OP Offline
Babel fish
Z
Joined: Jan 2005
Posts: 75
Now that is perfect, thanks!! smile

#111733 19/02/05 01:30 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Glad I could be of help smile


Gone.

Link Copied to Clipboard