Is it possible to open and read a text file that is within the app’s bundle? For testing purposes I have hard-coded the path to the file as follows:
set LogPath to "Optima:Users:bradbumgarner:Projects:FauxSecurity:FauxSecurity.app:Contents:Resources:Log.txt"
I am using the standard scripting additions “open for access” and “read” to build a list of lists that will be processed. Each item in the list will contain 1 to 6 items, both text and number data. I am building that list of lists as follows:
on ReadLogFile()
set theFile to open for access LogPath
try
repeat
set theLogList to theLogList & {read theFile before return using delimiter {tab, return}}
end repeat
end try
close access theFile
end ReadLogFile
I keep getting a -43 error (file not found). I would like to keep the text file in the bundle for ease of use and to hide the contents of the “security log” from unsuspecting eyes. I searched this bbs archive for threads pertaining to getting the path to the application. Building the path to the file in question doesn’t appear to be the problem. It seem (to me anyway) that the problem is the the “open for access” command not being able to find a file inside the app’s bundle.
This project is a tongue-in-cheek “security program.” It is totally harmless eye candy and is the kind of thing that you would put in your buddies start-up items on April Fool’s day. The Log.txt file contains the data that is displayed when the security program has been “breached” by the user.
Thanks in advance,
Brad Bumgarner, CTA