Button or Text in Window Titlebar

A lot of apps now have buttons or links showing the number of days remaining of a trial or links to buy the apps as text or buttons in the window’s titlebar, such as Coda / Unison and Linkinus to name a few examples.

I can’t see a way in Interface Builder to drag anything up to that position so anyone know how to do that.

Well I have found an article that describes how to do this - can anyone more experienced than me provide a translation of how I would call the two functions listed here http://iloveco.de/adding-a-titlebar-accessory-view-to-a-window/ from within my ASobjC app. Thanks

so i’ve managed to get so far thru the tutorial but am stuck converting this in asoc correctly

 NSView *themeFrame = [[mainWindow contentView] superview];

i’ve tried

tell class "NSView" of current application
			set themeFrame to its mainWindow_contentView_superview	
		end tell

but thats not quite right. any help would be great please.

Assuming mainWindow is a property referring to the window, you probably need:

mainWindow’s contentView’s superview()

Why would you want to convert that code to AppleScriptObjC?

The simplest way is to add the Objective-C files to your project and then call them from AppleScriptObjC.

This is what makes AppleScriptObjC so powerful, it’s ability to access Objective-C so easily.

Oh ok thanks. Was not sure how, thats why I way trying to convert it. I just about understand that you can call Obj-C from within the script and have the two class files from the example (if thats the correct term) the .m and .h which I’ve added to the project.

The example says:

So how would I access that method then from within my script, or is there some docs or tutorial I could follow.

I will do a short video tomorrow and upload it to my site. AllanCraig

wow! that will be great - thanks.

Video is now available here.

You can also watch the video online here.

Let me know if you have any questions.

Regards,

Craig

Thank you Craig, Very simple to follow - incredible.

You’re welcome. Glad it helped!