Saving live information to excel file every half hour

Hi Jason, long time no hear. Not a problem, except I can’t immediately remember all we were doing.

As downloaded the program is badly formatted in places, I find it hard to follow if the indenting is incorrect. (I know some of it could be the mismatch of tab settings between your PC and mine.) See Edit (on the menu) Auto-Format. If you don’t like it, just press use ‘undo’ (ctrl-z).

Line 526 “getMinute()” is commented out, and line 528 “getSecond” is not commented out. This was for faster testing. In use it should be the other way round. As is I think you will be getting file lines recorded every 30 sec, instead of 30 minutes.

When you say “resetting manually” I think you must be resetting each value manually, because the code on the single reset button has become confused. You have the function ResetAll, and that was supposed to have two calls to it, one from the button, and one from time.

Delete the code

//Test for click on reset all square
...
 ResetAll();
}
  }

Replace with this (two calls to ResetAll)

  //Test for click on reset all square
  if ( mouseY > 732 && mouseY < 750 &&     // test for cursor on reset all square
    mouseX > 165 && mouseX < 185           // and mouse button pressed resets all counts
    &&  mousePressed)
  {
      ResetAll();
  }
   
  // The action every timePeriod:
  int hours;
  hours = LocalDateTime.now().getHour();
  //print(String.format("tC %2d, Hr %2d, DateTime %s", timeCount1, hours, dateStamp()));
  if (hours == 23 && timeCount1 == 1) {
    ResetAll();
  }

Having said that I haven’t waited 24 hours to test it. I have it running set to reset for 11:00 to be sooner.

We’ve never talked about the whole program structure. It would have been better if the original author had learned to use arrays. This would have made a program with fewer lines and easier to adjust. As it’s working, you don’t have to do anything about this. Suppose you wanted to adjust the position of the values on screen so they were all right aligned, you’d have to change the position of all 38 values separately. If originally, the name display used the names from the array that I helped you put in, and if the values were stored in an array, then there would be one display routine (not 38) that displayed 38 items in turn, calculating the position from the number of the item. It would not need those 38 carefully inserted position selections for the reset clicks. If you should want to try this, find another PC to try things on and we can play there.

Richard