Solved... it is where the end if's were placed! local nM on mouseUp startProcess end mouseUp
command startProcess put fld dbPathList into nM open process nM for update set the cRunning of this card to true readloop end startProcess command readloop if the the cRunning of this card then read from process nM until empty if it is not empty then put it & cr after fld mergeOut put the number of lines of fld mergeOut * 16 into sPlace set the vscroll of fld mergeOut to sPlace end if if it contains "dblink disconnecting" then set the cRunning of this card to false close process nM exit to top end if end if send "readloop" to me in 1 tick end readloop On Wed, Mar 28, 2012 at 7:21 PM, Glen Bojsza <gboj...@gmail.com> wrote: > Well I appreciate the input. > > This area needs more examples since the potential is huge (IMHO). > > Worst case I lock the user down until the process completes but give a > nice "Be patient" message. > > regards, > > Glen > > > On Wed, Mar 28, 2012 at 7:14 PM, Mike Bonner <bonnm...@gmail.com> wrote: > >> Maybe its time to go with the Bob method? >> >> >> On Wed, Mar 28, 2012 at 7:13 PM, Mike Bonner <bonnm...@gmail.com> wrote: >> >> > Interesting. Not sure whats up then because "read until empty" should >> grab >> > whatever happens to be in the buffer at the time. Whether its read for >> 10, >> > or whatever all the same data passes through the buffer. Meaning the >> data >> > is the data and the method used to read shouldn't make a difference as >> far >> > as the content so I freely admit to being flummoxed. >> > >> > >> > On Wed, Mar 28, 2012 at 7:01 PM, Glen Bojsza <gboj...@gmail.com> wrote: >> > >> >> Hi Mike, >> >> >> >> Well using your code I get the expected result at the end of the >> process >> >> but the interim output that I try to capture shows nothing? >> >> >> >> So good news - using your method I get the end result and the user is >> free >> >> to do other things ; / bad news - I can't show the interim output for >> >> feedback. >> >> >> >> If I use the following code I get the opposite effect - user cannot do >> >> anything until the process completes but the interim output updates to >> the >> >> field. >> >> >> >> In both cases the process completes with the final results. >> >> >> >> So it has to do with the timing of the send and the reading of the >> process >> >> (I also tried reading lines and have the same result as reading >> characters >> >> as shown below) >> >> >> >> local nM >> >> on mouseUp >> >> startProcess >> >> end mouseUp >> >> >> >> command startProcess >> >> put fld dbPathList into nM >> >> open process nM for update >> >> set the cRunning of this card to true >> >> readloop >> >> end startProcess >> >> >> >> command readloop >> >> if the the cRunning of this card then >> >> read from process nM for 10 >> >> if it is not empty then >> >> put it & cr after fld mergeOut >> >> put the number of lines of fld mergeOut * 16 into sPlace >> >> set the vscroll of fld mergeOut to sPlace >> >> if it contains "dblink disconnecting" then >> >> set the cRunning of this card to false >> >> close process nM >> >> exit to top >> >> end if >> >> send "readloop" to me in 1 tick >> >> end if >> >> end if >> >> >> >> end readloop >> >> >> >> On Wed, Mar 28, 2012 at 5:35 PM, Mike Bonner <bonnm...@gmail.com> >> wrote: >> >> >> >> > Sorry for posting and falling off the earth. A bit sick today but >> will >> >> try >> >> > and give the gist of a send in time loop. This is just off the top >> of my >> >> > head and as always there are probably better ways to do this (also >> as I >> >> > mentioned before, not sure which forms of read will block and which >> >> won't >> >> > so your mileage may vary depending on need) >> >> > >> >> > command startProcess >> >> > ## code to connect to the process >> >> > open process "myprocess" for update >> >> > ## check for errors opening the process, if no errors then >> >> > set the cRunning of this card to true -- a method to break the loop, >> >> set to >> >> > false to stop the loop >> >> > >> >> > readloop -- handler to do the read >> >> > end startProcess >> >> > >> >> > command readloop >> >> > if the the cRunning of this card then >> >> > read from process "myProcess" until empty >> >> > if it is not empty then >> >> > #do whatever you want with the resulting read. >> >> > #if the end line is read, close process set the cRunning of this >> card to >> >> > false >> >> > end if >> >> > send "readloop" to me in 1 tick >> >> > end if >> >> > >> >> > end readloop >> >> > >> >> > >> >> _______________________________________________ >> >> use-livecode mailing list >> >> use-livecode@lists.runrev.com >> >> Please visit this url to subscribe, unsubscribe and manage your >> >> subscription preferences: >> >> http://lists.runrev.com/mailman/listinfo/use-livecode >> >> >> > >> > >> _______________________________________________ >> use-livecode mailing list >> use-livecode@lists.runrev.com >> Please visit this url to subscribe, unsubscribe and manage your >> subscription preferences: >> http://lists.runrev.com/mailman/listinfo/use-livecode >> > > _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode