Why no ScreenUp Dates

Sivakatirswami katir at hindu.org
Tue Aug 11 22:49:59 EDT 2009


I have a little stack that digs some log files.

it works well, but the UI is not updated until the repeat loops and 
handlers are all finished.

It is as if I had a "lock screen" at the start (which I don't)  but it 
acts like that.

I have a message that is to be inserted into a field and a timer that 
should update a field on each repeat loop.. But don't see anything until 
it is finished, only then is the GUI is updated.

perhaps the "Read from file" loop is a blocking call?


global gStart
local tPartials,tRevHits,tCompleted


on mouseUp
   put empty into fld "Time"  # Not happening... blocked
   put empty into fld "output" # Not happening... blocked
   put  the uDigging of fld "Status"  into fld "Status" # Not 
happening... blocked
 set the cursor to busy
   put 0 into tPartials
   put 0 into tRevHits
   put 0 into tCompleted
   put ticks() into gStart
   repeat for each line y in fld "path"
      put y & cr after tOutput
      open file y for read
      put 20000 into tStep
      put 1000 into tChunkSize
      put 1 & cr into tAccessLogFileChunk
      repeat  until tAccessLogFileChunk is empty
         read from file y for tChunkSize lines
         put it into tAccessLogFileChunk
         put processLogs(tAccessLogFileChunk) & cr after tOutput
         calcTime # Not happening... blocked
      end repeat
      close file y
   end repeat
   repeat 5 times
      replace (cr&cr) with cr in tOutput
   end repeat
   put  "Summary: " & Cr & "Downloaded with Revolution HT Navigator: " & 
tRevHits & cr  into tSummary
   put "Complete Downloads via HT site: " & (tCompleted - tRevHits) & cr 
after tSummary
   put tSummary & cr & "_________________" & cr before tOutput
# now all fields are updated:
   calcTime
   put tOutput into fld "output"
   put  the uFinished of fld "Status"  into fld "Status"
end mouseUp

function processLogs tAccessLogFileChunk
   put empty into tFoundLines
   repeat for each line x in tAccessLogFileChunk
      if x contains  fld "SearchString" then
         put x into z
         if z contains "Revolution" then add 1 to tRevHits
         put  ("1.1"&quote&" 200 ") into tCompleteCode
         put  ("1.1"&quote&" 206 ") into tPartialCode
         if z contains tCompleteCode then add 1 to tCompleted
         if z contains tPartialCode then add 1 to tPartials
         put empty into z
         put x & cr after tFoundLInes
      end if
     
     
   end repeat
   return tFoundLines
End processLogs

Stack script has:

global gStart

on openStack
   put the uIntro of fld "Status" into fld "Status"
end openStack
on calcTime
   put ticks()-gStart into tTicks
   if tTicks < 60 then
      put tTicks & " ticks" into fld "time"
   else
      put  trunc (tTicks/60) into tSeconds
      put  trunc(tSeconds/60) & " min. " & ( tSeconds mod 60) & " sec." 
into  fld "time"
   end if
end calcTime









More information about the use-livecode mailing list