Automator: Write/Overwrite to text file inside app resources folder

Hi there,

I am relatively new to Automator and I am struggling to get it to write / overwrite to a text file inside the overall apps Resource folder.

My workflow is as follows…

  1. Spotlight - search for .xml in Folder-A
  2. Combine text files
  3. New Text File (Plain text / UTF-8)

However I can’t seem to get it to save to a location inside the app bundle, I can only select a folder from my current folder structure and this will, of course, fall over when I try to run the app on a different machine.

I have attempted using the following Apple script:

set textFileLocation to ((path to me) as text) & “Contents:Resources”
set newAppPath to POSIX path of textFileLocation

And then set this location as a variable but I am unable to select the variable under Where in the “New Text File” action.

Any ideas?