1

I'm making a script that automatically installs Vivaldi. I've put the .app file inside the package contents (in the resources folder), and I want it to move the app to the Applications folder. So, I have 2 questions:

  1. Is this actually possible?
  2. If so, how?

I have this so far:

set Vivaldi to ((path to me as string) & "Contents:Resources:Vivaldi.app")
set AppFolder to "Macintosh HD/Applications/"
tell application "Finder"
    move application Vivaldi to AppFolder
end tell
Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265
  • Any reason you're not using the standard .pkg format? Or even just a plain old .zip? Ideally installing a self-contained .app should be as simple as unzipping it and dropping it into the `Applications` folder. If you have to install additional dependencies or run pre-/post-install scripts, use `pkgbuild` and `productbuild` to create a .pkg. Trying to invent your own ad-hoc installer instead of using the established one is likely to cause more problems than it solves. – foo Aug 01 '16 at 19:05

1 Answers1

1

If your trying to say the your making an Applescript Application that contains another application in the Resources folder that moves the contained application to the Applications Folder then YES This is possible :D!!! You can use this code here:

set vivaldiApp to POSIX path of (path to resource "Vivaldi.app")
do shell script "cp -r \"" & vivaldiApp & "\" /Applications/"

Thats IT!!!

Hope this Helped!!

YeaTheMans
  • 1,005
  • 8
  • 19
  • Nicely done; 2 suggestions to make this slightly more robust: use `quoted form of` instead of enclosing the path in double quotes; use `cp -R`; the `man` page for `cp` states re `-r`: "its use is strongly discouraged, as it does not correctly copy special files, symbolic links, or fifo's." – mklement0 Dec 21 '16 at 14:42