Set Value For MultiLine Label

Hello everyone!
After re-reading the 1st AppleScriptObjC tutorial, I started experimenting with text fields and such. I was wondering though, how would you set the value for a multi-line label? Let’s say the label first displayed the text “Hello!”, how would after, let’s say, five seconds you program it to display “Goodbye!”. This isn’t for any project of mine but it seems something that MacScripter should include for reference. (Sorry in advance if I glanced over a thread that already answers this question! :P) Hmmm, I predict that it will be something like myLabel’s setStringValue_(“Hello!”), am I right?

property myLabel : missing value

repeat 5 times
--Set myLabel to "Hello!"
delay 5
--Set myLabel to "Goobye!"
end repeat


You are, something like this

on applicationWillFinishLaunching_(aNotification)
        performSelector_withObject_afterDelay_("displayStringOnLabel:","Goodbye!", 5)
end applicationWillFinishLaunching_

on displayStringOnLabel_(aString)
        myLabel's setStringValue_(aString)
 end displayStringOnLabel_

So, if I were to do this, it would be correct?

myLabel's setStringValue_("Hello!")


Also, this isn’t related to this, but would this be how you open a drawer? Yeah, I know really off topic… But still, for some reason, it doesn’t work for me!

 theDrawer's open_(me)

to open a drawer programmatically, use the open() method (without parameter);
It could be that the pipes are necessary

theDrawer's |open|()

the open_() method with parameter is used as an action method to be connected to an UI element

Hmmm, I tried it and the same result… Here is the full script:

property theDrawer: missing value

on buttonGo_(sender)
      set theApp to (choose application)
      set theID to theApp
      theDrawer's |open|()
end buttonGo_

the code should work.
Is the drawer properly connected in Interface Builder

Okay, I made a new project and tried it on there, no luck. I have the parentWindow, the contentView, and a button called buttonWorks. This is my script:

script testAppDelegate
	property parent : class "NSObject"
	property theDrawer : missing value
	on buttonWorks_(sender)
		theDrawer's |open|()
	end buttonWorks_
	on applicationWillFinishLaunching_(aNotification)
	end applicationWillFinishLaunching_
	on applicationShouldTerminate_(sender)
		-- Insert code here to do any housekeeping before your application quits 
		return current application's NSTerminateNow
	end applicationShouldTerminate_

It’s important that the property theDrawer is connected to the NSDrawer object
and parentWindow of the NSDrawer object is connected to the proper window or panel object

you can also connect the sent action of the button directly to the open: action of the drawer

Yep, it seems like I’m crazy :P… But I swear I just dragged in a window & drawer set from my Library and some how it worked. But when I manually try to create a window and drawer it doesn’t work. It’s going to be a pain to drag all my stuff from my original window to the other window but I guess I’ll have to live with it. I don’t know what happened though… Interface Builder can really be mean to me…

OH WHY??? Okay, I think I might be going crazy, but now I guess it won’t work. I will find a way but thanks a lot Stefan for trying to help! I really appreciate it.


when you drag a drawer object from the Library you get three objects: a Window , a Drawer Content View and a Drawer.

If you want to use another window, delete the Window object and connect the parentWindow property of the Drawer object to the window you want to use

Thanks, I’ve got it to work!

Hmm, one more question ( I know I’ve asked a lot!). Is there anyway that you can make a progress indicator larger than the “regular” setting in Interface Builder?