AppleScript:复制文件,用 Seconds from Midnight 重命名,然后打开

AppleScript: Duplicate file, Rename it with Seconds from Midnight and then open it

我刚开始使用 AppleScript,无法理解我们非常简单(可能)的事情。我想复制特定文件,然后将副本重命名为仅 'seconds from midnight timestamp.indd'(以保持命名看似随机),然后在应用程序 Adob​​e InDesign 2020

中打开它

到目前为止我只有重复的部分:

tell application "Finder"
duplicate file "Macintosh HD:Users:user:Documents:filename.indd"
end tell

感谢您的帮助

如果我没理解错的话,你需要这样的东西:

set theSeconds to time of (current date)

tell application "Finder"
    set theDuplicate to duplicate file "Macintosh HD:Users:user:Documents:filename.indd"
    set name of theDuplicate to "" & theSeconds & ".indd"
end tell

tell application "Adobe InDesign CC 2020" to open file (theDuplicate as string)