Can't open old sketch: get blank and slow menu response

Recently downloaded 1.8.1 and used successfully to work with my Mega based, 1000 line sketch. Did changes and downloaded to the Mega and all seemed good.

Last night, opened the sketch and got a blank window with only a line number 1 showing. Attempts to use the menu gave very slow response. X off of the window was slow also. Uninstall and reinstall of 1.8.1 gave same result. Surprisingly, I can open the "blink" sketch and successfully download to the Mega. Tried uninstall and install of 1.6.1 and got the same problem. Tried using same sketch from my other PC, but since it's synced, it gave the same result.

Sketch size is 83K so think it's there, but please,please don't tell me it's somehow corrupted. I am not a particularly sophisticated user.

You could check by opening the sketch with a text editor.

Tried to open it with both Notepad and Wordpad ... get blank. Remember that the sketch/program is a .ino file. I've never understood the Arduino file types. Can a .ino file be read with a text editor?

Pick the bits that are relevant out of the attached file.
Then please report back…

CLEAN UP BEFORE INSTALLING ANOTHER COPY OF THE IDE OR ARDUINO CREATE.pdf (345 KB)

alwa:
Remember that the sketch/program is a .ino file. I've never understood the Arduino file types. Can a .ino file be read with a text editor?

Yes, it's just a text file, no special magic to it.

It appears the sketch is corrupted. I use google drive to sync my PC's. Inspection of the cloud copy of the sketch using Drive Notepad app shows a file full of dots. Wordpad and Notepad on my Win 10 laptop just shows a file full of blanks. Somehow, a IDE save loaded the file with an unrecognizable character ... how the @#%^@ does that happen?????

Luckily, I went through my Wastebasket and found a copy from Nov. Oh goody goody, I get to remember 4 months of changes.

This matter is closed ... until it mysteriously happens again!

Since it sounds like you're fairly experienced with programming, I'd suggest you consider using version control software such as Git on your programming projects. As long as you had your repository properly backed up, this would make it very easy to revert the corruption back to the last commit. There is a little bit of a learning curve but it's so worth it if you're to the point of working on a project over the course of months. Learning to use Git will also make it easy for you to contribute code or collaborate as it seems to be by far the most popular version control software currently.

Pert, thanks for explaining an alternative backup method. However, this only masks the symptoms of the disease. I've been perfecting this program for 3 years and this is the first time something like this has happened.

PS I just discovered that Google Drive has a 30 day revision history/old file capability. Wish I'd known that a few days ago.

alwa:
However, this only masks the symptoms of the disease.

No it doesn't mask the symptoms. It would have provided a cure for the disease with the absolute minimum of data loss as well as providing many other benefits. I'm not familiar with the revision history capabilities of Google Drive but I guarantee it doesn't hold a candle to Git.

alwa:
I've been perfecting this program for 3 years and this is the first time something like this has happened.

Then you've been extremely lucky.

pert:
Then you’ve been extremely lucky.

LOL … and I thought I only had to deal with my own mistakes!

Hello all, i had the same thing happen
I had a code written and had been working on it for a few weeks. I made sure to save and closed my laptop. i opened it the next day and nothing would come up so I rebooted. I'm running windows 10. I then opened my IDE and found it was empty. I tried what was listed here and eventually open the file in the web IDE and found a single bar of dots. I'm really hoping someone has figured out how to save the file and I salvage my work.

If you attach the file to a post here, I'll take a look at it. After you click the "Reply" button, you'll see an "Attachments and other options" link.

@skiziks

Include your web editor user name if it different to the one you use here and include the share link to the sketch you say is lost.

They will be needed to try recover your sketch