Activating an applescript in an applescript app

i wrote an applescript app in xcode using the follwing applescript. When i compiled the app, the script didn’t run. I’d like this script to run once every 10 seconds or so. Do you know what i did wrong?

tell application "Finder"
	set x to name of every process
end tell
if ("Adium" is in x) then
	if ("iTunes" is in x) then
		
		tell application "iTunes"
			set playerState to player state
			if playerState is playing then
				set theTrack to current track
				set theName to name of theTrack
				set theArtist to artist of theTrack
				set theStatus to "I'm listening to " & theName & " - " & theArtist as string
				try
					set theArt to (data of artwork 1 of theTrack)
				end try
				
			else
				set theStatus to "Paused"
			end if
		end tell
		
		tell application "Adium"
			if my status is away and idle then
				set my status message to theStatus
				try
					set file_name to ":tmp:artwork2avatar.pict" as string
					try
						do shell script "rm /tmp/artwork2avatar.pict"
					end try
					open for access file_name write permission 1
					copy the result to file_reference
					write theArt starting at 0 to file_reference as picture
					close access file_reference
					set theImage to open for access file file_name without write permission
					set ImageData to read theImage as TIFF picture
					set image of every account to ImageData
					close access theImage
				end try
			end if
			if my status is not away and idle then
				try
					set file_name to ":tmp:artwork2avatar.pict" as string
					try
						do shell script "rm /tmp/artwork2avatar.pict"
					end try
					open for access file_name write permission 1
					copy the result to file_reference
					write theArt starting at 0 to file_reference as picture
					close access file_reference
					set theImage to open for access file file_name without write permission
					set ImageData to read theImage as TIFF picture
					set image of every account to ImageData
					close access theImage
				end try
			end if
		end tell
	end if
end if

Try saving something like this as a stay-open application:

on run
	tell application "System Events" to name of every process
	
	if "Adium" is in result and "iTunes" is in result then
		tell application "iTunes"
			if player state is playing then
				tell current track
					set currentName to name
					set currentArtist to artist
					try
						set theArt to missing value
						set theArt to (data of artwork 1)
					end try
				end tell
				
				set theStatus to "I'm listening to " & currentName & " - " & currentArtist
			else
				set theStatus to "Paused"
			end if
		end tell
		
		tell application "Adium"
			if my status is away and idle then set my status message to theStatus
			(my status is away and idle) and (my status is not away and idle)
		end tell
		
		if result and (theArt is not missing value) then
			try
				open for access ("/tmp/artwork2avatar.pict" as POSIX file) with write permission
				set fileRef to result
				
				write theArt starting at 0 to fileRef as picture
				set imageData to read fileRef as TIFF picture
				close access fileRef
				
				tell application "Adium" to set image of every account to imageData
			on error
				try
					close access fileRef
				end try
			end try
		end if
	end if
end run

on idle
	run
	return 10
end idle