Leading tabs disappear when using Execute a JavaScript Automation action

The following JXA script:

"\tAlpha\n\t\tBeta\n\t\t\tGamma"

gives:

Alpha
        Beta
            Gamma

instead of:

    Alpha
        Beta
            Gamma

@peternlewis, are leading tabs deleted in the output of Execute a JavaScript Automation actions ? I've found the same behaviour with a shell script.

macOS Ventura

Leading tabs deleted.kmmacros (1.8 KB)

Have you tried turning off the "Trim Results" option? While it isn't mentioned on the JavaScript action's Wiki page, I believe it's the same as for "Execute Shell Script" in that

  • Trim Results — removes white space from the start and end of the scripts results.
3 Likes

Thank you, @Nige_S ! You solved the problem. Works perfectly now.