I'm trying to restart a script trough code...
I was thinking, because Plus restarts the script when it detects changes, I would change the script, through my own script
So I open the script, write a nullstring, and close it again...
Theoraticaly it should work, it also works when I open in notepad
But I can't seem to open the file, because it is "in use" or something
Can anyone help me?
I have this code so far:
code:
function Restart () {
try {
var File = fso.OpenTextFile(MsgPlus.ScriptFilesPath + "\\Main.js", 8, 0, -1)
File.WriteLine("")
File.Close()
} catch (e) {
//Couldn't restart...
}
}
And somewhere else in the script, I just want to read the contents, but it gives the same error:
code:
var File = fso.OpenTextFile(MsgPlus.ScriptFilesPath + "\\Main.js", 1, 0, -1)
var Lines = File.ReadAll().split(/\r\n?|\n\r?/)
File.Close()
fso is a declared FileSystemObject