mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2005
Posts: 122
O
Vogon poet
OP Offline
Vogon poet
O
Joined: Oct 2005
Posts: 122
hi if i had a simple
on *:DIALOG:name:*:*:{
if ($devent == init) {
...code here (say the list has the id 6)

and the files that would need to be listed are "$getdir"

Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
sample
Code:
dialog list {
  title ""
  size -1 -1 100 100
  option dbu
  list 6, 5 5 90 90, sort hsbar vsbar
}
on *:dialog:list:init:0:{
  var %null = $findfile($getdir,*,0,did -a list 6 $1-)
  did -z list 6
}

Joined: Oct 2005
Posts: 122
O
Vogon poet
OP Offline
Vogon poet
O
Joined: Oct 2005
Posts: 122
is it poss u could provide the coding for

if ($devent == dclick)

if its a folder, to change folders, and .. to go back etc.?

Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
you are thinking along the lines of @windows?
I have shown two ways.
1) Added a button, buttons are more understandable
if you plan to share your script
2) I did include double clicking inside the listbox. A cleaner look,
but others might be confused by "hidden" controls.
sample
Code:
dialog list {
  title ""
  size -1 -1 100 110
  option dbu
  list 6, 5 5 90 90, sort hsbar vsbar
  button "Change Folder", 901, 25 95 50 10
}
on *:dialog:list:init:0:{
  var %null = $findfile($getdir,*,0,did -a list 6 $1-)
  did -z list 6
}
on *:dialog:list:sclick:901:{
  if (!%filesource) { set %filesource $getdir }
  set %filesource $sdir(%filesource)
  did -r list 6
  var %null = $findfile(%filesource,*,0,did -a list 6 $1-)
  did -z list 6
}
on *:dialog:list:dclick:6:{
  if (!%filesource) { set %filesource $getdir }
  set %filesource $sdir(%filesource)
  did -r list 6
  var %null = $findfile(%filesource,*,0,did -a list 6 $1-)
  did -z list 6
}

Joined: Oct 2005
Posts: 122
O
Vogon poet
OP Offline
Vogon poet
O
Joined: Oct 2005
Posts: 122
umm not quite what i was thinking but it does the job smile

lol last thing i was hoping for is file sizes in both bytes and mb to be shown (either in a corresponding listbox/in the original listbox/ even a disabled editbox that shows the size of the selected one)

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
dialog list {
  title ""
  size -1 -1 100 130
  option dbu
  list 6, 5 5 90 90, sort hsbar vsbar
  list 7, 15 94 70 20
  button "Change Folder", 901, 25 117 50 10
}

on *:dialog:list:*:*:{
  if ($devent == init) {
    var %null = $findfile($getdir,*,0,did -a list 6 $1-)
    did -z list 6
  }
  if ($devent == sclick) {
    if ($did == 901) {
      if (!%filesource) { set %filesource $getdir }
      set %filesource $sdir(%filesource)
      did -r list 6
      var %null = $findfile(%filesource,*,0,did -a list 6 $1-)
      did -z list 6
    }
    if ($did == 6) {
      did -r $dname 7
      did -a $dname 7 $bytes($file($did($dname,6).seltext),b) bytes
      did -a $dname 7 $bytes($file($did($dname,6).seltext),m) mb
    }
  }
  if ($devent == dclick) {
    if (!%filesource) { set %filesource $getdir }
    set %filesource $sdir(%filesource)
    did -r list 6
    var %null = $findfile(%filesource,*,0,did -a list 6 $1-)
    did -z list 6
  }
}


-Andy

Joined: Oct 2005
Posts: 122
O
Vogon poet
OP Offline
Vogon poet
O
Joined: Oct 2005
Posts: 122
i did just a few modifications to remove most of the path, note the $remove's

Code:
dialog list {
  title ""
  size -1 -1 100 130
  option dbu
  list 6, 5 5 90 90, sort hsbar vsbar
  list 7, 15 94 70 20
  button "Change Folder", 901, 25 117 50 10
}

on *:dialog:list:*:*:{
  if ($devent == init) {
    set %filesource $getdir
    var %null = $findfile($getdir,*,0,did -a list 6 $remove($1-,$getdir))
    did -z list 6
  }
  if ($devent == sclick) {
    if ($did == 901) {
      if (!%filesource) { set %filesource $getdir }
      set %filesource $sdir(%filesource)
      did -r list 6
      var %null = $findfile(%filesource,*,0,did -a list 6 $remove($1-,%filesource))
      did -z list 6
    }
    if ($did == 6) {
      did -r $dname 7
      did -a $dname 7 $bytes($file($did($dname,6).seltext),b) bytes
      did -a $dname 7 $bytes($file($did($dname,6).seltext),m) mb
    }
  }
  if ($devent == dclick) {
    if (!%filesource) { set %filesource $getdir }
    set %filesource $sdir(%filesource)
    did -r list 6
    var %null = $findfile(%filesource,*,0,did -a list 6 $remove($1-,%filesource))
    did -z list 6
  }
}


Problem im finding is in $getdir (weather by initialisation or by selecting it) it wont show the file sizes now that i have done $remove($1-,$getdir)

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
dialog list {
  title ""
  size -1 -1 100 130
  option dbu
  list 6, 5 5 90 90, sort hsbar vsbar
  list 7, 15 94 70 20
  button "Change Folder", 901, 25 117 50 10
}

on *:dialog:list:*:*:{
  if ($devent == init) {
    set %filesource $getdir
    var %null = $findfile($getdir,*,0,did -a list 6 $remove($1-,$getdir))
    did -z list 6
  }
  if ($devent == sclick) {
    if ($did == 901) {
      if (!%filesource) { set %filesource $getdir }
      set %filesource $sdir(%filesource)
      did -r list 6
      var %null = $findfile(%filesource,*,0,did -a list 6 $remove($1-,%filesource))
      did -z list 6
    }
    if ($did == 6) {
      did -r $dname 7
      did -a $dname 7 $bytes($file([color:blue]$+(%filesource,$did($dname,6).seltext)[/color]),b) bytes
      did -a $dname 7 $bytes($file([color:blue]$+(%filesource,$did($dname,6).seltext)[/color]),m) mb
    }
  }
  if ($devent == dclick) {
    if (!%filesource) { set %filesource $getdir }
    set %filesource $sdir(%filesource)
    did -r list 6
    var %null = $findfile(%filesource,*,0,did -a list 6 $remove($1-,%filesource))
    did -z list 6
  }
}


-Andy

Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
Quote:
i did just a few modifications to remove most of the path, note the $remove's


this is my solution to having the files listed, no path showing, with the bytes and megabyte sizes listed after the filename.
note any files under 5k will show as 0mb. (megabyte rounding rule im guessing is over 5k is 0.01mb)
Code:
dialog list {
  title ""
  size -1 -1 100 110
  option dbu
  list 6, 5 5 90 90, sort hsbar vsbar
  button "Change Folder", 901, 25 95 50 10
}
on *:dialog:list:init:0:{
  var %null = $findfile($getdir,*,0,listfileinfo $1-)
  did -z list 6
}
on *:dialog:list:sclick:901:{
  if (!%filesource) { set %filesource $getdir }
  set %filesource $sdir(%filesource)
  did -r list 6
  var %null = $findfile(%filesource,*,0,listfileinfo $1-)
  did -z list 6
}
alias listfileinfo {
  var %listfile = $1-
  var %listsize = $bytes($file(%listfile),b).suf $bytes($file(%listfile),m).suf
  did -a list 6 $nopath(%listfile) %listsize
}


Link Copied to Clipboard