Go Down

Topic: Running Preload Script (Read 1 time) previous topic - next topic

Hiddenvision

Hi All,
Just a thought I aired on the ESP github but perhaps it should be here.

let me be lazy and just cut and paste that one here...
Esp8266 Arduino Github

Another random thought.

I use a small program to switch prefferences.txt files depending on the project I am working on.
 This sets the Device, Recent Sketches, port speed and the like before I start the IDE.
 Very handy if you use the IDE for multiple device types.
 The same app also lets me set all the possible debug flag defines from one place before I compile.
 Maybe not ALL but lets say, all that I needed.

I was wondered if the Arduino IDE has a method of running a preload script to perhaps automate this preference file changing process.
 Just before it loads any device dependant info, bam the user can run a script based on project name.
 Load this, rename that, start the com port OR NOT,.
 Just all those little twiddley bits you do different for projects or devices.

Perhaps I should be asking this in the Arduino Forum or some other place but I'm here now.!

Hv.



pert

That's completely off topic for the esp8266/Arduino issue tracker.

When exactly do you want this preload script to run?

I'd do it via the Arduino CLI. So to open a sketch you run a script/batch file written specifically for that sketch that's stored in the sketch folder. That script does any other external actions necessary, sets the preferences via the Arduino CLI, and opens the sketch.

Support for sketch-specific configuration of the Arduino IDE is a very common feature request but doesn't seem to be a priority for the Arduino developers. I believe the Arduino Web Editor does some of this, but of course it doesn't support your ESP8266.

Hiddenvision

#2
Feb 04, 2018, 04:46 pm Last Edit: Feb 04, 2018, 06:21 pm by Hiddenvision
@pert,

Off topic.! Oh I know, but I could not help myself at the time.!

As far as "Exactly When", who knows such things,
How or wherever it be done I would guess it would have to be "USER" proof.

I guess it was a thought in some attempt to give the IDE some flexibility
when developing multiple projects on different devices.

I see this is common thing discussed

Other Post
Hv.

pert

Yeah, the earliest feature request on the issue tracker I've found was 2013:
https://github.com/arduino/Arduino/issues/1481
There are 8 other duplicate feature requests linked from that issue report so it's been a consistently desired feature but not one the Arduino developers are interested in providing. I'm ambivalent on the subject. I could see where it could be useful but the common suggestion of configuring the IDE settings via sketch code doesn't seem like a good idea. I like code to just be regular C++ code without extra non-standard features shoehorned in.

Hiddenvision

#4
Feb 05, 2018, 05:41 pm Last Edit: Feb 05, 2018, 05:46 pm by Hiddenvision
@pert,
Agreed on that, but I guess it could be included at the top of the ino file then the settings are editable by the user "if desired".

To be honest there are so many methods that could be employed but I guess someone has to write the code.
Even as simple as having a prefferences file located in the project folder.

Was the IDE open-source and fully editable.?
if so then I guess we can only blame ourselves for missing or broken features.

Personally I just use my preference tool and I am happy enough for it not to bother me.


Hv.

Foot Note.
Why can I NOT edit a post within 5 mins of posting it.

I still get that message.
You have exceeded the number of posts you can make in a 5 minutes period.
Please try again later

I am not Making a Post, I am Editing one.

pert

Yes, the Arduino IDE is open source. I don't believe anyone has ever submitted a pull request for the desired change. I think the situation is definitely different between asking the Arduino developers to spend time adding a feature (when they have lots of work already fixing/improving existing features) vs. doing the work for them. However, they still need to approve it. Not ever pull request submitted gets merged.

Why can I NOT edit a post within 5 mins of posting it.

I still get that message.
You have exceeded the number of posts you can make in a 5 minutes period.
Please try again later

I am not Making a Post, I am Editing one.
Yes, it's a common complaint. In fact one of our forum moderators has even submitted a request for this to be fixed:
https://github.com/arduino/forum-issues/issues/258
Once you have made 100 posts the limit will go away.

Hiddenvision

@pert

Cool, I shall have a "look" at that later.


Hiddenvision

#7
Feb 06, 2018, 07:53 pm Last Edit: Feb 06, 2018, 08:08 pm by Hiddenvision
From PreferencesData.java

Code: [Select]

  private static final String PREFS_FILE = "preferences.txt";

static public void init(File file) throws Exception {
    if (file == null) {
      BaseNoGui.getPlatform().fixSettingsLocation();
    }
    if (file != null) {
      preferencesFile = file;
    } else {
      preferencesFile = BaseNoGui.getSettingsFile(PREFS_FILE);
    }
..............
}


Seems like the init can actually take a file name, to use instead of the default.

I will look to see where that is called from,

Hiddenvision

Quote
Once you have made 100 posts the limit will go away.
Do edits count as Posts.!!
I also notice after the first edit delay I don't appear to see any more delays during editing/saving.
Yep I make mistakes.!


Hv.

Go Up