Can an arduino sketch switch "board" when it's opened?

I program often for multiple borads.
It's a pain in the a** the way I do it:
Open a sketch, then tools, board, (select proper board) Ctrl-U - happyness... open another sketch, and repeat everything.

I'd like a open sketch to be able to set the proper board.

is there some directive to do so ?
Thank you.

Your sketch can't set the board type. About the best it can do is generate a compile error if you have set the wrong board.

I believe this fork has that feature...

thanks, looks like a great tool. Will give it a try later.

Is it possible that a feature request like this will go thru wih the original Arduino IDE ? :
โ€œ- check the 10 first lines of a .ino project for a commented-out, or directive line that indicates preferred board - if found, then select that board.โ€

This is where requests can be added to the heap...

I believe the request is already there (somewhere).

The best way to get a feature added is to implement it then create a pull request on GitHub.