I have used Automator to create an app bundle that activates an app ("Fuse") within the Resources directory of the bundle, which then opens the file "Exolon.tzx" (also located in Resources).
However, I can only get this to work when pointing to the full location of "Exolon.tzx" while the app is on my Desktop. Obviously, when I move the app it no longer works.
What do I need to change in this script to have it point to and open "Exolon.tzx" regardless of where I keep the app (in particular, I want it to work when I transfer the app to another Mac).
My script:
tell application "Fuse"
open POSIX file "/Users/almeath/Desktop/Exolon.app/Contents/Resources/Exolon.tzx"
end tell
tell application "System Events"
set frontmost of process "Fuse" to true
end tell
tell application "System Events"
keystroke "f" using command down
end tell
When I run the app from the Desktop it activates the Fuse app, opens Exolon.tzx and then executes the specified keystroke. If I move the app to another location (i.e not the Desktop) then an error is produced: “The action Run AppleScript encountered an error: “Fuse got an error: Connection is invalid”