mIRC Homepage
Posted By: Online for nightchillz - 04/02/03 11:42 AM
this is hopefully a working version of your files treeview:
Code:

dialog switchbar {
  option dbu
  size -1 -1 110 110
  list 2, 5 5 100 105
  list 3, 5 5 100 105, hide
}
 
on *:dialog:switchbar:init:0:{
  ;
  ; edit here
  ;
  dll $mdx SetMircVersion $version
  dll $mdx MarkDialog $dname
  dll $mdx SetControlMDX 2 TreeView hasbuttons > dll\mdx\views.mdx
  ;
  ; root folder 
  ;
  var %root = $mircdir
  window -hls @f
  var %files = $findfile(%root,*,0,@f), %dirs = $finddir(%root,*,0,@f)
 
  did -i switchbar 2 1 cb root
  did -a switchbar 2 +eb Folder $gettok(%root,-1,92) has %files files in %dirs subdirs.
  did -i switchbar 2 1 cb last
  did -a switchbar 2 +b $gettok(%root,-1,92)
  did -i switchbar 2 1 cb last
 
  var %i = 1
  while $line(@f,%i) {
    var %line = $ifmatch, %nopath = $nopath(%line)
 
    var %count = $count(%line,\), %prev_count = $count($line(@f,$calc(%i - 1)),\)
    while %count < %prev_count {
      did -i switchbar 2 1 cb up
      inc %count
    }
 
    if $isdir(%line) {
      did -a switchbar 2 +b %nopath
      if %line isin $line(@f,$calc(%i + 1)) {
        did -i switchbar 2 1 cb last
      }
    }
    else {
      did -a switchbar 2 %nopath
    }
    inc %i
  }
  window -c @f
}

If you have further questions about mdx, I think mircscripts's experts can be more helpful.
Posted By: NightChillz Re: for nightchillz - 04/02/03 06:14 PM
Well, i took out the "s" in the /window part, cause it wasnt working with it, now that i took it out, it does show me ALL the files i have in my script folder, but not within their folders, i'll try to play with it a little more, but if you come up with something, let me know, an thanks for that smile
Posted By: Online Re: for nightchillz - 04/02/03 06:38 PM
the -s swtich is very important for the script. what do you mean by "wasn't working"? did it list something?
Posted By: NightChillz Re: for nightchillz - 04/02/03 07:09 PM
the -s switch was sorting the @window, thus the files listed in the @window were not in order by way they were found...
so i would have like 3 files in the main folder, then another folder, then 6 more file in the main again, then another folder, then more files in main, etc, and samething within the subdirs, i guess you could say it "works", but not totaly what i was looking for, something like this, if possible:

you have the main folder, then it lists all the first layer folder within, then it lists all the files in order within the main folder, then if you open one of the subfolder, it has the same type of list,(all the folsder within that folder, then all the file within that folder)

know what i mean?

but i do have to say, that it is closer to what i want with the -s swicth, lol.....Also a little error i think you made, was in this part:

if $isdir(%line) {
did -a switchbar 2 +b $gettok(%line,-1,92)
;%nopath
if %line isin $line(@f,$calc(%i + 1)) {
did -i switchbar 2 1 cb last
}
}
else {
did -a switchbar 2 4 %nopath
}


see the first part, you had %nopath, and then the same for the else, once i changed that it was workin better, cept for the part i mentioned above about the way it lists them...
Posted By: Online Re: for nightchillz - 04/02/03 07:21 PM
I understand what you say. that's the best way I could think of. making it look exactly as it looks in Windows Explorer, would be much harder to implement, but I'll think about it later.

About %nopath, well, it works for both folder and file names, since $finddir doesn't put a slash - \ - at the end of the folder names.

$nopath(c:\mirc), which is indeed a folder name, outputs 'mirc'.
Posted By: NightChillz Re: for nightchillz - 04/02/03 08:06 PM
hmm, i c, i wasnt sure bout that, because i had thought that a while ago, i think it was a previous version of mirc, and whatever i was trying to do, $nopath for the folder name wasnt workin, so i had to do it the other way, but i see it works fine now/in this version, thanks again, and i will play with it a little to see if i can get what i want, and will also eep checking back here to see if you came up with anything , thanks alot again online smile
© mIRC Discussion Forums