Moving files inside .app directory

This being my first post, I’d like to say thank you for welcoming me to this site (reading the intro.), it looks like an extremely helpful rescource.

I don’t do much AppleScripting, and what I do know is limited. I am part of a Battlefront forum, which has lots of custom content. This content can be frustrating for new users to install, so I decided to undertake in writing a droplet application to do it for them. The application requires that custom game content be placed inside the application, which gives me applescript errors no matter what I seem to put. The directory I’m aiming for is Star Wars Battlefront.app > Contents > AddOn.

Here’s what I’ve gotten so far, I’ve tried for hours combing through Apple’s developer documentation searching for some sort of answer to no avail. Perhaps someone here can help me? Here’s the source:

on open names
	tell application "Finder" to move names to folder "AddOn" of folder "Contents" of folder "Star Wars Battlefront.app" of home
	quit
end open

There’s probably a simple solution to this, and any help would be immensely appreciated.

Thank You.

Hi,

path to application gives you the path regardless where the application is on disk.
The try block avoids error messages if Star Wars Battlefront doesn’t exist

on open names
	try
		tell application "Finder" to move names to folder ((path to application "Star Wars Battlefront" as string) & "Contents:AddOn:")
	end try
end open

Thanks for the help. Unfortunately, it’s having trouble finding it, or accessing it’s contents. If the application is in my home folder, do I need to point it there, or will it automatically seek out the application? Trying to run this script (without the try blocks), it gives me error type “5”. After adding " of home" after the Finder tell statement, it still didn’t work. Is it possible there’s a syntax error in that, or that applescript in the Xcode development enviroment is slightly different? I really can’t say much, as I know little to nothing about AS.