M28 doesn't allow tabs to be written to file.
-
@owend, thanks for reporting this. I have added it to my list of things to look at.
-
@owend Have you tried M560? Just make sure to include the P parameter or I heard it can nuke your config.g! But the reason I suggest it is I've found that M560 will write comments, where M28 won't. So maybe it treats tabs differently as well. I don't know.
Where with M28 you'd do this:
M28 "<filespec>"
. . .
M29With M560 you do this:
M560 P"<filespec>"
. . .
<!-- EoF --> -
@donstauffer
My Understanding is that M559/M560 upload previously written files whereas M28 actually creates the file.
Therefore unless I create the file externally, it doesn't help as the "problem" , small though it is, is that M28 won't allow tab characters to be written to the file. -
@owend I routinely create files with M560. In fact, if I want to create a macro which creates a macro, I nest them:
Create a macro named "Maker", containing:
M560 P"/macros/Outer"
M28 "/macros/Inner"
M98 P"/macros/Another"
M29<!-- EoF -->
Now, if you run "Maker", it creates a file "Outer", which contains:
M28 "/macros/Inner"
M98 P"/macros/Another"
M29And then, if your run "Outer", it creates a file "Inner", which contains:
M98 P"/macros/Another"
Then, if you run "Inner", it will make a call to macro "Another".
-
@owend The forum is doing something strange - it removed the asterisks from that termination (EoF) string, so if you copy and paste that it won't work. The string actually should have a pair of asterisks immediately preceding and after "EoF".
-
@owend I just tested the example I gave, with tabs. Both M28 and M560 preserved the tabs in the files they wrote. I put a pair of tabs directly after "M28" and "M98", and they did appear in Outer, and the M98 pair of tabs did appear in Inner, which was written by M28.
-
@donstauffer
I'm not seeing where your examples are creating macros with indented conditional code like the examples I posted. -
@owend I tried it with an "if" and an indented "set", and M560 handled it but M28 didn't. Possibly M28 eats the tabs but only at the beginning or end of a line.
-
There is an inconsequential error in this example. it should be "set var.X = 5", but since it will never execute it doesn't matter.
-
@owend The limitation on M28 actually presents a problem on a project I'm currently working on, because the project has macros which do nested writes, which can only be achieved using both M560 and M28, and the nested write does include a conditional. I haven't thought of how to deal with that yet.
I'm wondering if there's a character meta commands consider to be indents but M28 doesn't consider space to be removed. A no-break space (C2 A0) didn't work. Neither did a character code 255.