我正在将应用程序存储在USB上。当插入USB时,应用程序(在同一USB上)应自动在硬盘驱动器中搜索具有特定名称的任何文件并将其传输到USB。我知道如何找到文件并移动它们,所以我真正需要知道的是如何自动运行应用程序。有人可以帮忙吗?
如果有人需要,可以查找文件的代码(贷款给用户Vadian):
set startupDisk to POSIX path of (path to startup disk)
set endLocation to POSIX path of ((path to me as string) & "Contents:Resources")
set filename to "pdffilename.pdf" as string
do shell script "mdfind -onlyin " & quoted form of startupDisk & " -0 'kMDItemDisplayName = \"" & filename & "\"' | xargs -0 -J {} cp {} " & quoted form of endLocation