Search code examples
xcodeapplescript-objc

How to Show terminal output in a NSScrollView in Applescript?


  I can do this with a textField as follows:

property textField : missing value set theOutput to do shell script "blahblahbla" with administrator privileges tell textField to setStringValue_(theOutput)

but when trying to do the same with ScrollView I get the following Error: -[NSScrollView setStringValue:]: unrecognized selector sent to instance 0x600003d0c3c0 Thanks in advance!


Solution

  • You are getting the error because the NSScrollView class doesn't have a setStringValue: method. If you are talking about using an NSTextView, in the Interface Editor, drag in a Text View object - this is embedded in a Scroll View. Click through (or select) the Scroll View, Clip View, and Text View as desired, making changes in the Attributes Inspector (font, scroll bar settings, etc). Make your outlet connection to the Text View, and use its setString: method to set the string property.