[javascript-dev] Re: progress indicator...
pnyboer
pnyboer at slambassador.com
Mon Jul 9 20:55:53 MDT 2007
- Previous message: [javascript-dev] another example of weird javascript crosstalk
- Next message: [javascript-dev] JSUI and inlets/outlets
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
for the sake of the archive, here is a working version that uses the jitter listener to break up and schedule the task, keeping you informed of the progress along the way.
#P window setfont "Sans Serif" 9.;
#P window linecount 4;
#P comment 310 190 100 196617 the js makes 12 copies of the file "dozer.mov" into the folder.;
#P button 287 185 15 0;
#P number 113 241 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 261 186 21 196617 t 0;
#P newex 152 187 106 196617 prepend moverastask;
#P user multiSlider 152 287 113 60 0. 10. 1 2920 15 0 0 2 0 0 0;
#M frgb 0 0 0;
#M brgb 255 255 255;
#M rgb2 127 127 127;
#M rgb3 0 0 0;
#M rgb4 37 52 91;
#M rgb5 74 105 182;
#M rgb6 112 158 18;
#M rgb7 149 211 110;
#M rgb8 187 9 201;
#M rgb9 224 62 37;
#M rgb10 7 114 128;
#P newex 152 213 66 196617 js movem.js;
#P user dropfile 152 104 319 158 1;
#P comment 163 116 127 196617 drag an empty folder here;
#P window linecount 6;
#P comment 282 289 100 196617 is it possible to show the progress of the movie copying? Nothing comes out of the js outlet until everything is done.;
#P connect 2 0 5 0;
#P connect 2 0 6 0;
#P connect 8 0 6 0;
#P connect 6 0 4 0;
#P connect 3 0 7 0;
#P connect 3 0 4 0;
#P connect 5 0 3 0;
#P window clipboard copycount 10;
//-----begin movem.js
/*
moves the dozer.mov file to a specified folder 11 times, and provides progress while doing it.
*/
autowatch = 1;
mov = new JitterObject("jit.qt.movie");
mov.autostart = 0;
var movlisten = new JitterListener(mov.getregisteredname(), thecallback);
var movepath;
var movecounter = 0;
var TASK_INTERVAL = 1;
var MOVEIT = new Task(movetask,this);
function mover(topath){
for (var i=0; i<11;i++){
var tomove = mov.read("dozer.mov");
var saveto = topath+i+mov.moviename;
post("
savingto",saveto);
mov.savemoviecopy(saveto);
mov.flatten(saveto);
myout = i;
outlet(0,myout);
}
}
function moverastask(topath){
movepath = topath;
var limit = 11;
if (!MOVEIT.running){
MOVEIT.execute();
}
}
function movetask(){
var tomove = mov.read("dozer.mov");
var saveto = movepath+movecounter+mov.moviename;
post("
savingto",saveto);
mov.savemoviecopy(saveto);
mov.flatten(saveto);
post("
counting",movecounter);
outlet(0,movecounter);
movecounter++;
}
movetask.immediate = 0;
function thecallback(event)
{
if (event) post("
listen",event.eventname);
if (event.eventname=="flatten"){
if (movecounter<12) MOVEIT.execute();
}
}
//end movem.js
--
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The Lifespan
2 oz brandy
1/2 oz orgeat
1/2 oz maraschino
3/4 oz mix of (meyer) lemon and (yellow) grapefruit juice
Shake with ice and serve in a Pernod-rinsed cocktail glass
- Previous message: [javascript-dev] another example of weird javascript crosstalk
- Next message: [javascript-dev] JSUI and inlets/outlets
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
