JavaScript from AppleScript

I’m doing some Photoshop scripting and I have a script that needs to do some JavaScript because Photoshop has some functionalities for JS that’s not available for AS; therefor, I have to create a text file with the JS and make a call to it from my AppleScript.
The problem is that other people are going to be using this script and I don’t want the text file to get trashed or lost on their computer because obviously my script would fail to work. On that note, is it possible to somehow run the JS from AS as if it is a text file, or would I have to create a text file from AS. If I had to create the text file, I would prefer to create the text file, then delete it once the script is finished, but I would like to see how you experts would put the code together for creating and deleting the text file.

take advantage of the fact that you can save as an application bundle and put the JS script file in your bundle… that’s what it’s for. To group resources with the apps that need them… If you’re really set on making a file each time, put it in the temporary files folder (/tmp/username/) and don’t worry about deletion because it gets removed automatically by the OS