How to display multiline output in a label field?

Hi Guys,

I’m trying to display a continuous output of a button action in a label. Here’s an example of my script:

property theLabel1 : missing value -- connected to the label's text field

on thebuttonclicked_(aNotification)
    theLabel1's setStringValue_("Hello There!" & do shell script "ls -l /volumes/")
end thebuttonclicked_

The script works as intended but I would like to display the do shell script “ls -l /volumes/” in the following line after hello there! I tried adding \n before the command but it’s not working. Appreciate some help on this.
Thank you in advance.

Model: MacBookPro 6,2
AppleScript: Version 2.10 (194)
Browser: Safari 537.36 OPR/54.0.2952.54
Operating System: Mac OS X (10.13 Developer Beta 3)

it sounds like you’re not using a wrapping label.

Thanks for your prompt reply Shane. Well, I’m trying to achieve something like this:

The second part of the command should display in the following line instead of immediately after the first. Adding “\n” before the command didn’t do the trick :frowning:

theLabel1's setStringValue_("Hello There!" \n & do shell script "ls -l /volumes/")

Model: MacBookPro 6,2
AppleScript: Version 2.10 (194)
Browser: Safari 537.36 OPR/54.0.2952.54
Operating System: Mac OS X (10.13 Developer Beta 3)

Don’t use “\n” – it will compile to a return in the code. Use “Hello there” & linefeed & …

Awesome! You nailed it again Shane! Thank you so much :smiley: