将一个应用程序从另一个应用程序内部移动到另一个文件夹

Moving an application from the inside of another application to a different folder

我正在制作一个自动安装 Vivaldi 的脚本。我已将 .app 文件放在包内容中(在资源文件夹中),我希望它将应用程序移动到应用程序文件夹。所以,我有 2 个问题:

  1. 这真的可能吗?
  2. 如果是,怎么做?

到目前为止我有这个:

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

如果你想说你制作的 Applescript 应用程序包含 Resources 文件夹中的另一个应用程序,将包含的应用程序移动到应用程序文件夹,那么是的,这是可能的 :D!!!您可以在此处使用此代码:

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

就是这样!!!

希望对您有所帮助!!