Search code examples
emeditor

option to continue with current encoding when opening corrupted file using OpenFile macro method


While opening a partly corrupted file using OpenFile (encoding specified), there isn't an option to force it using the specified encoding, thus the macro is interrupted.

Is there an option in macro to force it "Continue opening as Current Encoding", instead of letting the user choose and continue?


Solution

  • You can clear the Prompt if Null Character Found and Prompt if Invalid Character Found options in the File page of configuration properties of the file type. To do this in a macro, you can add the following code before OpenFile.

    document.ConfigName = "Text";  // replace "Text" with the configuration of your file type
    cfg = document.Config;
    cfg.File.PromptInvalid = false;
    cfg.File.PromptNull = false;
    cfg.Save();