I have a .nb (notebook) file which I should convert to a .m (mathematica package) file to run it remotely from command line of a high performance computing server. Before doing that I want to test whether my .m file runs correctly or not. (If I could run a .nb file using the command line then I didn't have all this trouble explained below!)
In my .nb file, I have used the Symbolize command for introducing the indexed symbols and I have used Save to get the output of the code in the format of a .m file. Everything works fine when I run the .nb file and the output is produced. Here is a simple code in a .nb file
Notice that the Symbolize is used from Notation palette and $x_1$ is entered as x + Ctrl + _ + 1. But when this is converted to a .m file (see this answer for converting .nb to .m), it turns into
ClearAll["Global`*"]
Needs["Notation`"]
Symbolize[ParsedBoxWrapper[SubscriptBox["x", "i_"]]]
Subscript[x, 1] = 1;
SetDirectory[NotebookDirectory[]];
Save["OutPut.m", Subscript[x, 1]]
and after running the .m file I get this error
which means that $x_1$ is not a symbol. According to the following code, I conclude that Symbolize is not working in a .m file or there is some problem in the conversion of .nb to .m!
What should I do to fix this? Specifically, what should I do so that after converting .nb to .m such errors do not come up?
Any help or suggestion is appreciated. :)



SubscriptBoxis symbolized, notSubscript, and expectingSubscript[_,_]to be considered a symbol is wrong. Of course you can doSubscript[x,1]=2but this has nothing to do withSymbolize. It just creates downvalues forSubscriptitself. p.s. you don't need GUI, you just need Mathematica and runNotebookEvaluate @ path, (UsingFrontEndmay be needed). – Kuba May 31 '17 at 09:53