[javascript-dev] Re: progress indicator...
pnyboer
pnyboer at slambassador.com
Mon Jun 4 12:06:26 MDT 2007
- Previous message: [javascript-dev] Re: Saving files by js
- Next message: [javascript-dev] External text editor
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Josh, thanks for the hints.
I gave this a shot, and didn't get the results I hoped for!
Here's a js that uses a task instead of a for loop to copy the file. It just sort of stops after one iteration, even though I specify the task to run 11 times.
Clearly it has to do with my interval of "1", so how do I get it to execute the task asynchronously without guessing at the interval?
I'm also confused about something in the JavascriptInMax documentation (pg 34):
"Although the overall timing accuracy of a Task function is high, the latency between the
scheduled time and the actual execution time of a Task function is variable because the
function runs in a low-priority thread."
BUT LATER on pg 45...
"In summary, a function will execute at in the high-priority thread...
? if the function?s immediate property is set
and
? the js receives a message to invoke the function at high-priority
or
? the function is executing via a js Task object "
Aren't these 2 things contradictory?
//-----begin junk.js
/*
moves the dozer.mov file to a specified folder 11 times.
*/
mov = new JitterObject("jit.qt.movie");
mov.autostart = 0;
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.interval = TASK_INTERVAL;
MOVEIT.repeat(limit);
post("
running task ",limit," times");
}
}
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;
//----------end junk.js
/*
--begin max patch
#P window setfont "Sans Serif" 9.;
#P window linecount 4;
#P comment 251 131 100 196617 the js makes 10 copies of the file "dozer.mov" into the folder.;
#P button 227 125 15 0;
#P number 53 181 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 201 126 21 196617 t 0;
#P newex 92 127 106 196617 prepend moverastask;
#P user multiSlider 92 227 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 92 153 53 196617 js junk.js;
#P user dropfile 92 44 259 98 1;
#P comment 103 56 127 196617 drag an empty folder here;
#P window linecount 6;
#P comment 222 229 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 3 0 7 0;
#P connect 3 0 4 0;
#P connect 6 0 4 0;
#P connect 5 0 3 0;
#P window clipboard copycount 10;
//end maxpatch
*/
--
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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] Re: Saving files by js
- Next message: [javascript-dev] External text editor
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
