> Thanks for help. I have implemented message callback function. I have > another question. I think it is more of a javascript question rather > than JMol.
Please write Jmol with a lower-case 'm' > I want to know how can I keep checking a variable for a > particular value, in my case "script completed", and when find it, I > move ahead with my program's next line. This is the type of JavaScript problem that has caused me a lot of problems ... and made me discouraged about building a better/more generic event notification between Jmol and JavaScript. > i have tried using Settimeout > function in javascript, but its not working. > > I did something like this > > function show() > { > --- > --- > while (abc != "script completed") > { > setTimeout(check(),100) > } You certainly do not want to do this ... it looks like to me that this is essentially an infinite loop ... calling setTimeout a huge number of times. Each time you call setTimeout it returns immediately, but it has queued a call to check() 100 ms in the future. You only want to call setTimeout one time. > } > > function check() > { > var a=document.name.value; --->from message callback > a=a.split("\n"); > abc=a[0]; > } > > abc is holding the value of first line from message callback I want to > monitor its value to check for "script completed", and if it is I move > to next line in loop. > I don't think that you want to do it this way. I don't think you want to think of it as 'waiting' until the script completes. Rather, I think that you want to restructure it and think of it as 'run this function when the script completes'. But I cannot give you any specifics because I do not have a lot of JavaScript programming experience. Miguel ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf _______________________________________________ Jmol-users mailing list Jmol-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-users