I had three sketches running in 2.3.6. None of them had been saved or named.
All were working fine. As you do, I went off to do something else, leaving the PC working.
When I came back, all three sketch coding had disappeared leaving just blank editing blocks.
The tempoary names given when creating a new sketch were there, the last upload dialogues were there.
I looked in users>AppData\Local\Temp.arduinoIDE-unsaved2025423-18412-1ck0b6z.d0jqi\sketch_may23a
The above was one of the three.
Opening that gave a sketch folder, empty.
I can't think what could have happened while I was away. No Windows update or similar.
Another thing I notice is where it says unsaved2025423 etc., what is 2025423 all about? It looks like a date code with year 2025 and day 23, correct, but month 4? It's May now, month 5.
I know I should have saved the files, but losing all the code by leaving it alone for an hour or so?
Hello
Thanks
That looked promising but I just checked the PC settings and sleep and hibernate are both off.
There is a sleep button on the functions row of the keyboard, but it needs a two key press to operate, so I don't think it's that.
Only the screen is set to go off after 30-minutes.
Yes, it is 2.3.6
But, interestingly, I had 1.8.19 running as well which had a new unsaved sketch on it.
That was untouched.
So 2.3.6 lost the contents and 1.8.19 didn't.
Looks as though something else with 2.3.6 is going on.
It's a right nuisance.
The code part of the screen is totally blank and the compilation part is not affected.
Hi @tigger. It might be possible to recover your code. Arduino IDE copies your sketch to a temporary folder during the compilation process. It is possible the full sketch is still stored in that folder. It would be at this location:
(where <username> is your Windows username, <some hash> is some characters used to differentiate the folder name, and <sketch name> is the name of the sketch)
If looking for it with your file manager or command line, note that the AppData folder is hidden by default. On Windows "File Explorer", you can make it visible by opening the "View" menu, then checking the box next to "☐ Hidden items".
Note that a .cpp file extension has been appended to the original sketch filename.
You can try doing a search through that folder for the filename of your sketch.
This storage location is temporary in nature. It might be overwritten by Arduino IDE or deleted by your operating system at any time. So if you are going to try to recover the sketch from this location, you should do it as soon as possible and immediately move it to a safe location once you find it.
You should also be careful to avoid performing actions that could possibly trigger the loss of the data before attempting the recovery:
Do not compile or upload your sketch in Arduino IDE.
Do not close Arduino IDE.
Do not shut down or restart your computer.
Do not perform any operations to automatically free up disk space.
If you find the sketch file in the temporary folder, you will notice Arduino IDE made some changes in the code. These changes are minimal so it will be easy to convert the code back to your original sketch. We can help you out with that if you have trouble.
Also note there is only a single digit for the month. Would that happen for the day as well? Could it distinguish between December 1st and February 11th?
It may not matter if it is only generating part of a temp name, where there are enough other "random" parts to avoid collisions.
Thanks for that information.
It's a new one on me.
I'm not a not a good programmer by any stretch of the imagination.
I do enough to get by, but came by Arduino too late in life to have any formal training in coding.
I do a fair bit of Excel work and of course many of their functions involving dates like Weekday use different numbering systems, 10 at the last count, depending which day you want the week to start on.
It didn't occur to me that months could start with zero.
In the wider world, January is designated the first month of the year, month 1.
Thanks @ptillisch
Much appreciated.
I'll have a look in the location you suggest and report back.
Of course, the lesson is, always, save the work.
Save it or lose it.
I often have to recover Excel files from Windows temporary files, especially when Microsoft sneaks in an update. Try as I may, pausing updates, one slips through.
No problems like that with Linux Ubuntu which quietly gets on with updates without ruining your day.