0
votes

I am trying to write a simple applescript to move the contents of a file into the package contents folder of an application. I tried using automator to do this, but I was unable to access the package contents of the application. I am very new to applescript but this is what I have written so far.

tell application "Finder"
   set source_folder to (choose folder with prompt "Select the Step5 Folder:")
   set target_folder to folder "MacintoshHD:Applications:BlueJ.app:Contents:Resources:Java:userlib"
copy every file in folder source_folder to folder target_folder
end tell

Right now I am getting the following error

error "Finder got an error: Can’t make folder \"userlib\" of folder \"Java\" of folder \"Resources\" of folder \"Contents\" of application file \"BlueJ.app\" of folder \"Applications\" of startup disk into type integer." number -1700 from folder "userlib" of folder "Java" of folder "Resources" of folder "Contents" of application file "BlueJ.app" of folder "Applications" of startup disk to integer

I have tried googling the error and I have not found anything that has been applicable to what I am writing.

Thanks

2

2 Answers

2
votes

Try:

set source_folder to (choose folder with prompt "Select the Step5 Folder:")
set target_folder to "MacintoshHD:Applications:BlueJ.app:Contents:Resources:Java:userlib"

tell application "Finder" to duplicate files of source_folder to target_folder
0
votes

You specified 'folder' twice... the error was for moving the file to: folder folder path