Start Arduino IDE with specific sketch and corresponding com poort

Is there a way to start the ide with a specific project. and configure the appropriate com port for that sketch.
I have several Arduino's connected to my pc.
When my computer shutdowns for an update or something and reopen the ide i often upload the wrong code to the wrong arduino.
because all projects i open are connected to the latest used com port.
My laptop is using windows.

Kind regards

Johan

Well you could ensure the right code by opening the IDE with a double-click on the .ino rather than from the IDE icon.

Not sure about the com port thing, though.

I'm running Windows 7 and for some reason Windows can't associate an ino file with the IDE either.

Tried to setup windows to recognise the file association but it refuses to work.

I have to open the IDE and then select the file or/ double click the ino and then select "search windows" and then "browse" to the IDE execute icon.

I have Win7Pro, the association works for me.

arduino ino.PNG

I tried also setting file association in the IDE properties by checking the associate button.

Close the iDE then open again to the properties and the associate button is unchecked again.

What happens when you double click the .ino file in Windows?

bluejets:
or/ double click the ino and then select "search windows" and then "browse" to the IDE execute icon.

I can open the sketch by opening the ino.
But i want also to save the appropriate com port each project.
So if i open project one it should be com8
when i open project 2 the com is set to com12
when i open project 3 its com18 etc etc

Do you have a board plugged in to your usb at the time?

If I open any code I've written without having a board connected the tools always show Com 1 but if I plug in a board the program goes to Com 8 each and every time.

So no problem for me there.

As it stands I've kind of become used to having to do the "browse" thing , the rest works flawlessly.

yes four of five arduino's are always connected.

O mine always opens with the latest used com port.
but Now i have a line as remark in my code with the approriate com port for each program. but if it opens with the correct port i don't need to think about it any more

Kind regards

Johan