Page 1 of 1

Disable python script on sim startup?

Posted: Sun Aug 14, 2016 7:26 am
by RyanK
I modified the NOAA weather plug-in (just deleted a few lines) to stop it from downloading clouds and visibility. This is great for instrument training, since you can keep real world winds, pressures, etc. but still fly approaches to minimums. One downside is that when I'm not going to use it I need to remember to turn it off. Not a big deal normally, but in a flight school environment where people will be using the sim solo, I'd prefer to tell them to turn it on if they're using it, rather than having to turn it off otherwise. Does anyone know of a way to make python scripts, or the python engine itself, not start up automatically when launching X-Plane?

Re: Disable python script on sim startup?

Posted: Sun Aug 14, 2016 7:52 am
by Kyle.Sanders
Would this work for you? I use it to disable/enable plugins/scenery prior to starting x-plane.
http://forums.x-plane.org/index.php?/fi ... onmanager/

Re: Disable python script on sim startup?

Posted: Sun Aug 14, 2016 9:41 am
by RyanK
Thanks Kyle, that almost does what I'm looking for. The problem is that it makes the plugin disappear completely from the menu. What I want is for it to be disabled by default every time the sim starts, and then users can enable it by choosing "Plugins/Python Interface/Script Enable-Disable."

Re: Disable python script on sim startup?

Posted: Sun Aug 14, 2016 12:28 pm
by Kyle.Sanders
I know of no easy way to do that.

Here is "somewhat" of a solution.... I am not at my computer right now and cannot confirm this but if the python manager will allow you to "reload scripts" without a restart like LUA does:

Make a .bat file that renames the specific scripts you want to disable to .pl.off (or something similar)

and then have that .bat file start XP after the rename.

That should do it.

If you are then in the sim and want to turn the disabled scripts back on, just go take off the .off extension in the file name and reload scripts from the XP Python manager.
(You can make a script to rename it back too)

Re: Disable python script on sim startup?

Posted: Sun Aug 14, 2016 12:41 pm
by Kyle.Sanders
Please... Please understand that I am an armature at this coding stuff.... But this is my general idea... Again... I can't confirm this right now. Doing this from my phone and memory.

Code: Select all

Echo off
echo Renaming Python File
ecno.

CD “C:\USER\DESKTOP\X-PLANE 10\RESOURCES\PLUGINS\PYTHON SCRIPTS”
REN “weather script.pl” “weather script.off”

Re: Disable python script on sim startup?

Posted: Sun Aug 14, 2016 12:43 pm
by Kyle.Sanders
And this would be ran to turn the script back to normal:

Code: Select all

Echo off
echo Renaming Python File to turn it back on
ecno.

CD “C:\USER\DESKTOP\X-PLANE 10\RESOURCES\PLUGINS\PYTHON SCRIPTS”
REN “weather script.off” “weather script.pl”
After this one is ran, go to the python manager and "reload scripts" if it is possible... And then you have your script back.

Re: Disable python script on sim startup?

Posted: Sun Aug 14, 2016 3:49 pm
by RyanK
Kyle, that's a solution I wish I'd have thought of! I now have two shortcuts on the desktop. One disables (renames) the weather plug-in and starts the sim, and the other enables it and starts the sim. That's an even better solution than I was looking for. Thanks!

Re: Disable python script on sim startup?

Posted: Sun Aug 14, 2016 4:10 pm
by Kyle.Sanders
RyanK wrote:Kyle, that's a solution I wish I'd have thought of! I now have two shortcuts on the desktop. One disables (renames) the weather plug-in and starts the sim, and the other enables it and starts the sim. That's an even better solution than I was looking for. Thanks!

Wow.... This was the very first time my "coding" knowledge has helped someone :D haha