mIRC Home    About    Download    Register    News    Help

Print Thread
#28858 09/06/03 05:05 PM
Joined: Jan 2003
Posts: 148
K
Knappen Offline OP
Vogon poet
OP Offline
Vogon poet
K
Joined: Jan 2003
Posts: 148
How do i update the progress bar while i`m loading an folder with mp3`s in the list of my mp3 dialog?

I`m using mdx.dll and the code for the progress bar is this:

Code:
 
alias progress dialog -m progress progress

dialog progress {
  size -1 -1 129 44
  option dbu
  text "Lager liste...", 1, 5 7 120 15
  text "", 2, 1 22 127 18
}

on *:dialog:progress:init:*: {
  mdx.load
  dll $mdx SetControlMDX $dname 2 ProgressBar smooth > $ctl
  dll $mdx SetDialog $dname style dlgmodal
  dll $mdx SetFont $dname 1 -17 400 Verdana
  load.up 
}

alias load.up {
  var %dsg = 0
  while (%dsg <= 100) {
    inc %dsg
    .timer -m 1 $calc(25 * %dsg) .did -a progress 2 %dsg 0 100
  }
} 

 

#28859 09/06/03 07:00 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
I answered your trackbar quetion here: https://forums.mirc.com/showflat.php?Cat=...amp;amp;fpart=1 perhaps that will help you.


-KingTomato
#28860 09/06/03 07:21 PM
Joined: Jan 2003
Posts: 148
K
Knappen Offline OP
Vogon poet
OP Offline
Vogon poet
K
Joined: Jan 2003
Posts: 148
Yes, thank you, but in this section i`m asking how I update the progressbar dialog with stuff so the bar moves..

My first attemp was to load a folder with mp3`s in the list in the dialog and using the mdx progress bar to display the progress. But I don`t know how to make the bar run while the mp3`s are loading..?

#28861 09/06/03 08:08 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
you could do it, but making it happen would be using the $findfile, and N out of X songs loaded etc.. Ex:

Code:
; Syntax: /loadmp3 <dialog> <id_of_list> <id_of_progress_bar>
alias loadmp3 {
  var %mp3dir = C:\music
  var %songs = $findfile(%mp3dir, *.*, 0), %cursong 1
  /did -ra $$1 $$3 1 1 %songs
  /did -r $$1 $$2
  while (%cursong <= %songs) {
    /did -a $$1 $$2 $findfile(%mp3dir, *.*, 0)
    if (%curSong \\ 10) || (%curSong == %songs) /did - ra $$1 $$3 %curSong 1 %songs
    /inc %cursong
  }
}


But that is laggy as all hell, considering it has to show a progress bar, and load the songs. If you just load it with one line:

var %load $findfile(C:\music\, *.*, 0, did -a $dname 1 $1-)

then it loads over 500 songs in less than a second. No time for a progress bar there. >:D


-KingTomato
#28862 09/06/03 09:13 PM
Joined: Jan 2003
Posts: 148
K
Knappen Offline OP
Vogon poet
OP Offline
Vogon poet
K
Joined: Jan 2003
Posts: 148
ok... I tries to modify it a little to make in compatible with my script but it didn`t work. I`ll paste the entire code so you can take a look at it and rewrite to fitt my script. smile

Code:
  
alias loadmp3 {
  var %mp3mappe = $$sdir(C:\,Velg en mappe å legge til listen) 
  var %songs = $findfile(%mp3mappe,*.mp3,0,write mp3dir.lis $1-), %cursong = 1 
  .echo -q $findfile(%mp3mappe,*.mp3,0,write mp3list.lis $remove($nopath($1-),.mp3))
  did -ra progress 2 %songs   
  while (%cursong <= %songs) {      
    if (%curSong \\ 10) || (%curSong == %songs) { did -ra progress 2 %curSong 1 %songs }   
    inc %cursong 
  }
}

on *:dialog:mp3:menu:*:{
  if ($did == 80) {  
    $loadmp3
    progress
    did -r $dname 1
    loadbuf -o $dname 1 mp3list.lis 
    dialog -x progress  
  }

alias progress dialog -m progress progress

dialog progress {
  size -1 -1 129 44
  option dbu
  text "Lager liste...", 1, 5 7 120 15
  text "", 2, 1 22 127 18
}

on *:dialog:progress:init:*: {
  mdx.load
  dll $mdx SetControlMDX $dname 2 ProgressBar smooth > $ctl
  dll $mdx SetDialog $dname style dlgmodal
  dll $mdx SetFont $dname 1 -17 400 Verdana
  load.up 
}

alias load.up {
  var %dsg = 0
  while (%dsg <= 100) {
    inc %dsg
    .timer -m 1 $calc(25 * %dsg) .did -a progress 2 %dsg 0 100
  }
} 



This is it. i need it all to work togethoer you know... Now you have all the relevant things to make it work.. Pleace fix it for me smile Thank you very much!!!

#28863 09/06/03 10:02 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Code:
alias loadmp3 {
  var %mp3mappe = $$sdir(C:\,Velg en mappe å legge til listen)
  var %songs = $findfile(%mp3mappe,*.mp3,0), %cursong = 1 
  did -ra progress 2 %cursong 1 %songs
  while (%cursong <= %songs) { 
    /write $iif(%cursong == 1, -c) mp3list.lis $remove($nopath($findfile(%mp3mappe, *.mp3, %cursong)),.mp3)
    if (%curSong \\ 10) || (%curSong == %songs) { did -ra progress 2 %curSong 1 %songs } 
    inc %cursong 
  }
  /did -ra progress 3 List Loaded!
  .timer 1 1 /dialog -c progress progress
}

on *:dialog:mp3:menu:*:{
  if ($did == 80) { 
    $loadmp3
    progress
    did -r $dname 1
    loadbuf -o $dname 1 mp3list.lis 
    dialog -x progress 
  }
}

alias progress {
  if ($dialog(progress)) /dialog -vie progress progress
  else /dialog -mdo progress progress
}

dialog progress {
  size -1 -1 129 44
  option dbu
  text "Lager liste...", 1, 5 7 120 15
  text "", 2, 1 22 127 18
  text "", 3, 5 30 70 8
}

on *:dialog:progress:init:*: {
  /mdx SetMircVersion $version
  /mdx MarkDialog $dname
  /mdx SetControlMDX $dname 2 ProgressBar smooth > $ctl
  /mdx SetDialog $dname style dlgmodal
  /mdx SetFont $dname 1 -17 400 Verdana
  .timer 1 2 loadmp3 
}


-KingTomato

Link Copied to Clipboard