Using IDE 1.8.19. Is there a way to change the default sketch that loads on startup? At the moment, it’s the last one that was up.
Also, when the IDE is launched and another sketch is then accessed, there is a second IDE launched. Is there a way to make the original launch change out the sketch to the new one that is accessed, having only one IDE launch at a time?
If you pass the path to a sketch as an argument to the Arduino IDE invocation, it will open that sketch instead of the default behavior of restoring the sketch you had open at the time of exit of the previous Arduino IDE session.
You can do that manually from the command line invocation, but of course that would be inconvenient to do every time you start Arduino IDE. However, it can be done in a more convenient manner by defining the sketch path argument in the application shortcut you use to start Arduino IDE. If you would like assistance in setting that up, just tell us which operating system you are using and we'll provide the appropriate instructions.
Not that I am aware of, but maybe one of the other forum helpers will have an idea.
Two options: continue previous project or start something fresh.
If I want to continue, I go to my project folder and click the .ino file. For something fresh I click the icon in the start menu, wait till the IDE and the previous sketch are loaded and click File > New Sketch and wait for the IDE to load again. I might circumvent the reloading by deleting and typing something fresh, but that is worse: the sketch in my project is GONE (default settings).
I'll provide more detailed instructions you can follow to disable the sketch restoration behavior of Arduino IDE 1.x:
Select File > Preferences... (or Arduino > Settings... for macOS users) from the Arduino IDE menus.
The "Preferences" dialog will open.
Click the link on the line following "More preferences can be edited directly in the file" in the "Preferences" dialog.
This will open a folder in your file manager.
Switch back to the Arduino IDE window.
Select File > Quit (or Arduino > Quit Arduino for macOS users) from the Arduino IDE menus.
All Arduino IDE windows will close. ⓘ Arduino IDE overwrites the preferences file on exit, so it is necessary to exit Arduino IDE before manually editing preferences so that the IDE won't overwrite your changes.
Switch back to the file manager window.
Use any text editor to open the preferences.txt file you find in that folder.
Change the line that looks something like this:
last.sketch.count=1
to this:
last.sketch.count=1
Change the line that looks like this:
preferences.readonly=false
to this:
preferences.readonly=true
Save the file.
Please note that this makes it so that Arduino IDE can't save any preferences, so it will forget any changes you make to the preferences every time you exit the IDE. It also won't remember the selections from the Tools > Board, Tools > Port, Tools > Programmer, etc. menus you had selected during the previous session. And it won't update the File > Open Recent menu. So I'm not sure the benefits outweigh the disadvantages.
Another approach is described earlier in that topic:
Although this will require adjusting the invocation used to start Arduino IDE (similar to the solution I mentioned in post #2, it doesn't impact the usability of the IDE.
I just tried it with the approach I described in post #2 and that worked fine for me.
I don't have Arduino IDE 1.x associated with .ino files on my system, and I don't like messing with that sort of thing because I have had bad experiences with Windows stubbornly remembering file associations no matter what I try to get it to forget. Since there is an alternative approach, I don't feel the need to do it for the sake of this support effort. So I didn't try to reproduce the exact problem you had.
It works fine for me with the approach from post #2.
I was surprised to find that I was not able to pin the Arduino IDE 1.x application to the Windows taskbar in the normal way, where I start the application, right-click its taskbar icon, then select "Pin to taskbar" from the context menu. However, I was able to accomplish it by dragging the shortcut to the taskbar. That approach is probably superior anyway, as it guarantees the pinned item is the shortcut and not just the application itself.
If you want to wait for the developers to implement a proper solution, that is fine. If you want to implement the proper solution yourself, that is fine. I'm here to try to provide solutions that anyone can use right now with the software we have now.
That depends on what your goal is. @lgrant stated the following goal:
I interpreted this as wanting Arduino IDE to open a specific sketch that exists on disk. The solution I provided does just that.
It seems that your goal is to make Arduino IDE create a new sketch on startup, not to make it open a specific existing sketch. If that is your goal, you could try the (admittedly less than ideal) solution described here:
For now, I’ll go the desktop shortcut to a blank sketch route - that’s an easy workaround.
Now issue 2: one would like for the IDE to populate that blank sketch with the file they select to open, leaving the blank sketch unchanged. Presently, I’ll get another launch of the IDE that will take time and leave the first launch to close up. Any ideas?
I'm not sure I understand. If you want to select a sketch to open in Arduino IDE, then you should just start Arduino IDE by opening that sketch. You can associate Arduino IDE with files that have the .ino sketch file extension. So you can just double click on the .ino file of a sketch, and Arduino IDE will start with that sketch open.
My .ino files are spread out and generally with the project which is generally in its own directory and the directory may have 2 or 3 or 4 levels of sub-directories. And to drill down for the relevant .ino file is somewhat more laborious than my new approach of simply clicking on the desktop icon that takes me to a blank sketch and from there one can click on file > open recent and select the sketch you want. Maybe I’m just too accustomed to using Excel and Word.
I also tend to use File > Open... or File > Sketchbook (or the Sketchbook panel if using Arduino IDE 2.x), but I also don't have .ino files associated with Arduino IDE so I don't even have the alternative of opening the sketch directly via a double click in File Explorer.