Carriage returns in the editor

Hi. I’m having a bit of a problem with strings. When imbedding /r in a string, script debugger seems to view them as carriage returns when compiling. So instead of seeing “Grapes/rApples/rPears” in one line, it shows up in the editor as


This is untidy. Any idea how to get around this problem? Thanks!

I presume you mean "“Grapes\rApples\rPears”. What you’re seeing is the AppleScript compiler in action. Use this instead:

set x to "Grapes" & return & "Apples" & return & "Pears"

This is also a pretty good place to use a Text Substitution. Define one that changes this:


into this:

" & return & "

Now you can type \r then space, followed by delete to get rid of the space.

You can also do something similar for \n and linefeed.

Not perfect, perhaps, but still handy for those who are used to using \r and \n.

1 Like

Gotcha! Thanks for the info, clears that up!

I would like to see an Option for this as in Apple’s Script Editor. I very often use Linebreaks in my Scripts and my code gets unreadable some time.

As a workaround, I often set properties for these:

property CR : return
property LF : linefeed

--- Then you can have:

set x to "Grapes" & CR & "Apples" & CR & "Pears"
set x to "Grapes" & LF & "Apples" & LF & "Pears"
1 Like