\n my best friend...

Hey guys

A while a go I wrote an applescript that did a lot of useful operations for me.

A part of it was to create a string that contained some “\n” like for QR CODE generation in InDesign.


Somestring\nSomeotherString\nThirdString

As you cannot write \n in applescript - it causes libebreaks inside the script,-I used some characters instead of the ,\n’ s like “#$%” and had a bash script replace them with “\n”. Now I was wondering if there’s a better method with object c to get a string that contains multiple “\n”

You can use:

"Somestring" & linefeed &"SomeotherString" & linefeed &"ThirdString"

I tried that before. It doesn’t work for my purpose. It has to be “\n” as text and line feed doesn’t print that it just makes a newline.

If you want to print \n you use \n.

And this is where the problems start :slight_smile:
I tried that also.

I need to write a line like this in a file with a batch command (not the AS ‘write to file’)

“String\nOtherString\nThirdString”

If I escape \n it writes exactly that to file…

“String\nOtherString\nThirdString”

Which is wrong…

My thoughts were more like having an NSARRAY {String,Other string,…} an join it somehow with \n as separator

Can you show us your code/

It sounds like you should be using what I suggested originally, but quoting it.

Erm… it works with the escape. Dunno why it didn’t when I tried first. Close! :confused: