user26629: I'm testing three different Arduino (nano, Uno and Mega) each of them having a nRF module. The codes (sketches) are different for each module.
I've connected the arduinos to my single laptop via 3 USB ports.
Problem is, whenever I want to re-upload a sketch and fix a bug, I have to choose board model and port number of that sketch by using the menus. It has become frustrating using mouse each time I need to change something.
How can I set these parameters in code so each sketch knows which port and model it is related to?

user4143: You can't in the Arduino IDE, it's not designed that way (you can't even have different board/port settings in different windows - it's stored in the Java equivalent of a single global).
Instead you will have to switch to a different programming environment.
Personally (since I am the author) I would suggest switching to UECIDE. That has far more advanced facilities than the Arduino IDE, yet still retains most of the simplicity of use.
In UECIDE you can not only have different ports and boards selected in different windows, you can also configure individual sketches to automatically select their board and port.

Sketch -> Sketch Properties... -> Objects tab



26629: <p>I'm testing three different Arduino (nano, Uno and Mega) each of them having a nRF module. The codes (sketches) are different for each module.<br>
I've connected the arduinos to my single laptop via 3 USB ports.</p>

<p>Problem is, whenever I want to re-upload a sketch and fix a bug, I have to choose board model and port number of that sketch by using the menus. It has become frustrating using mouse each time I need to change something.<br>
How can I set these parameters in code so each sketch knows which port and model it is related to?</p>
 4143: <p>You can't in the Arduino IDE, it's not designed that way (you can't even have different board/port settings in different windows - it's stored in the Java equivalent of a single global).</p>

<p>Instead you will have to switch to a different programming environment.</p>

<p>Personally (since I am the author) I would suggest switching to <a href="http://uecide.org" rel="nofollow noreferrer">UECIDE</a>. That has far more advanced facilities than the Arduino IDE, yet still retains most of the simplicity of use.</p>

<p>In UECIDE you can not only have different ports and boards selected in different windows, you can also configure individual sketches to automatically select their board and port.</p>

<ul>
<li><p><strong>Sketch -> Sketch Properties... -> Objects tab</strong></p>

<p><a href="https://i.stack.imgur.com/5gjft.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5gjft.png" alt="enter image description here"></a></p></li>
</ul>
