Search field in the toolbar with Interface Builder 3.0

“Yaaay!” I thought when i played around with interface builder’s new toolbar features.
It’s now possible to add a search field to your toolbar!

But i really can’t figure out how to get the search string out of the search field.

I was hoping something simple like

set SEARCHSTRING to contents of text field "searchField" of toolbar "toolBar" of window "main"

But this search field is not just an text field. It even has a search field cell! Never seen that before!

So please help me!


hm jasper,

i just tried it myself. it looks like that the search field is a “search field cell” of a “search field” and not a text field. though, none of these get accepted by xcode.

lol - weird


Search fields are accessed as text fields in AppleScript Studio. (NSSearchField is just a subclass of NSTextField). However, anything inside a toolbar item is probably not supported via AppleScript Studio at this point (I think you’d have to use ObjC).

Do you know how to do this in ObjC?
Sure would like to learn that part.

I mean a toolbar is great! But the one thing almost every toolbar has is a search field.

Another question.
Does that mean that we still have to use script to make a toolbar? Like that’s the only way to do it with Applescript?
Is it possible to make a toolbar using Interface builder and only use the buttons?

Cheers in advance!