Code: Select all
on mouseUp
-- get the colon separated values
set the itemDelimiter to colon
put fld "Start" into tStart
put fld "Stop" into tStop
-- convert into minutes
put item 1 of tStart *60 + item 2 of tStart into tStart
put item 1 of tStop *60 + item 2 of tStop into tStop
-- solve cross-midnight issue by adding 24H to tStop
if tStart > tStop then add 24*60 to tStop
put tStop-tStart into tDuration
-- convert the result in minutes into decimal hour and round to 1/10
set the numberFormat to "0.0"
put round (tDuration/60,1) into tDuration
put tDuration into fld "Duration"
end mouseUp
Code: Select all
put round ((tStop-tStart)/60,1) into fld "Duration"
HTH