Help needed to link up buttons on HUD Window to Applescript

Hi

I have very limited experience of XCode, though I did build a very simple application some time ago that appended text to the Comments field of the currently playing track in iTunes using Applescript. The design of this app was basically just a set of drop down menus.

I now want to redesign this as a HUD Window, and thought it best to start again. Unfortunately because it was a while ago I have forgotten the steps I took to design the original app and having done some reading and googling I am still stuck.

What I have done so far is to create a new Cocoa Application, design a HUD Window with all the necessary buttons in IB and add the Applescript from the original project to the Classes Folder in XCode. The AppleScript basically just consists of a series of arguments like this:

on tempo3_(aNotification)
		tell application "iTunes"
			
			set current track's comment to ((get current track's comment) & " " & "tempo:3")
			
		end tell
	end tempo3_

In the original document the Applescript was listed in the MainMenu.xib window in IB as an App Delegate and I could ctrl click on buttons/menu items and link them to the various applescript instances/arguments in the Applescript, but since I copied the applescript from the old project to the new it isn’t showing up in the MainMenu.xib window, so I’m obviously missing out an important step, and wonder if someone could point me in the right direction.

Thanks

Nick

First, make sure you created a Cocoa-Applescript app, not a Cocoa app. Secondly, if you created a separate class, you’ll have to specify that you want this action to access that script. It’d be easier to copy/paste your old script into the default class.

Make your IBOutlets and connect them in IB.

Then to call an action when you click a button, it’ll be something like:

on myButton_(sender)
     //your code here
end myButton_

OK I started from scratch with a Cocoa-Applescript app and it’s working now. Thanks for your help