What I’m trying to do is that when the user runs the App from outside the Applications folder, a display alert appears asking if he wants to move the App to the Applications folder if the App is not already there. I tried the following:
tell application (path to frontmost application as text) set myApp to path of document 1 set folderApplications to "/Applications" as POSIX file set anyApp to "/Applications/My.app" as POSIX file tell application "Finder" if exists anyApp then display alert "There is already an App with the same name in Applications Folder. return else tell application "System Events" move myApp to folderApplications end tell end if end tell end tell
but I get the following error: ERROR: Can’t get «class FTPc» of document 1. (error -1728)
Note: In the Script Editor it works well.