For a better integration with git version control, I'm looking for a way to programmatically generate .wls file from existing notebook .nb files, given the path to a specific notebook file /path/to/foo.nb, preferably from a command line interface via wolframscript. NotebookSave[EvaluationNotebook[], "test.wls"] does not work and saves the file as a normal notebook named "test.nb".
Also tried: this is achievable via file>save as...>choose format .wls; however, FrontEndTokenExecute["SaveRename"] only brings up the 'save as...' dialogue, not able to programmatically set the output format as wls or click save.
FrontEndExecute[ FrontEndToken[EvaluationNotebook[], "Save", {StringDrop[NotebookFileName[], -2] <> "wls", "Script"}]]– egwene sedai Mar 02 '18 at 16:46