slynch8 / 10x

10x IDE/Editor
184 stars 33 forks source link

"Reload Scripts" command #1613

Open Phildo opened 1 year ago

Phildo commented 1 year ago

justification:

wrapperup commented 1 year ago

As a work around, I made a script that adds a Restart command that saves all your changes and restarts the editor. Might need to adjust the paths here but this was what I used:

import N10X
from os import path
from subprocess import Popen

def Restart():
    N10X.Editor.SaveAll()
    p = Popen(path.expandvars(r"%APPDATA%\10x\PythonScripts\restart.bat"))

Optionally, if you want the auto-reload for Vim.py editing, add:

def PostFileSave(filename):
    if path.normpath(filename) == path.expandvars(r"%APPDATA%\10x\PythonScripts\Vim.py"):
        Restart()

N10X.Editor.AddPostFileSaveFunction(PostFileSave)

Then add a batch file named restart.bat in your scripts folder

@taskkill /im 10x.exe
start "" "C:\Program Files\PureDevSoftware\10x\10x.exe"