need help with itunes controller.

ok this is quite long but I really need help bad. I have made two scripts. One is a script that you just type in the name of a song and iTunes automatically starts playing it.This is the script (oh by the way these are just normal scripts made in applescript not in XCode

property the_song : "Search for your song."
set repeat_num to 0 as integer
repeat
	set repeat_num to repeat_num + 1
	if repeat_num is 1 then
		set dialog_text to "Which song do you want to play?"
	else
		set dialog_text to "Your search turned up 0 results. Try again?"
	end if
	repeat
		set the_dialog to (display dialog dialog_text default answer ¬
			the_song buttons {"Play", "Cancel"} default button 1)
		set the_song to the text returned of the the_dialog
		if the_song is not "" then exit repeat
	end repeat
	tell application "iTunes"
		set fi_value to fixed indexing
		set fixed indexing to true
		set the matching_tracks to (every track of library playlist 1 whose name contains the_song) as list
		
		--if there's only one match, it is played
		if the (count of matching_tracks) is 1 then
			set my_track to item 1 of matching_tracks
			exit repeat
			
			--if there are more than one matches...
		else if the (count of matching_tracks) > 1 then
			
			--creates a variable containing info about each matching track
			repeat with i from 1 to the (count of matching_tracks)
				set track_name to the name of item i of matching_tracks
				if the artist of item i of matching_tracks is not "" then
					set track_artist to the artist of item i of matching_tracks
				else
					set track_artist to "Unknown"
				end if
				if the album of item i of matching_tracks is not "" then
					set track_album to the album of item i of matching_tracks
				else
					set track_album to "Unknown"
				end if
				set track_info to i & ". " & track_artist & " - " & track_name & " (" & track_album & ")" as string
				if i is 1 then
					set matching_track_display to (track_info) as list
				else
					set matching_track_display to matching_track_display & track_info
				end if
			end repeat
			
			--allows user to choose which matching track to play
			set the_track to (choose from list matching_track_display with prompt ¬
				"Your search turned up more than 1 result. Please specify the track you want to play") as string
			if the result is "false" then
				set fixed indexing to fi_value
				return
			end if
			
			--finds which track to play
			set ascii_bounds to {48, 49, 50, 51, 52, 53, 54, 55, 56, 57} as list
			set the_number to ""
			repeat until the (ASCII number of the first character of the_track) is not in ascii_bounds
				set the_number to the_number & character 1 of the_track
				set the_track to (characters 2 thru -1 of the_track as string)
			end repeat
			set my_track to item the_number of matching_tracks
			exit repeat
		end if
	end tell
end repeat
tell application "iTunes"
	play my_track
	set fixed indexing to fi_value
end tell
tell application "Finder" to set the visible of every process whose name is "iTunes" to false

and i am also planning to have a remote control with a simple play/pause button, a back song and next song button. The nib is a nstab view with the tabs song search and controller. the controller tab has 3 buttons on labelled “<<” “Play/Pause” and “>>” i dont know how to make the script work so when the buttons are preseed they do their correct action. please help:(

EDIT: I figured out the remoe control and it works fine now. but i’m still having problems with the song player.