开发者

How does one copy (duplicate) and move a file from the same folder as the AppleScript code?

开发者 https://www.devze.com 2023-04-05 03:33 出处:网络
Something along these lines? tell application \"Finder\" duplicate file \"somefile.txt\" of folder of (file (path to m开发者_JS百科e)) to folder applications of folder startup disk

Something along these lines?

tell application "Finder"
    duplicate file "somefile.txt" of folder of (file (path to m开发者_JS百科e)) to folder applications of folder startup disk
end tell


You're very close, but here is the correct script.

tell application "Finder" to duplicate "somefile.txt" of (container of (path to me)) to applications folder

tell application "Finder"
    set prevTIDs to Applescript's text item delimiters
    set Applescript's text item delimiters to ":"
    duplicate "somefile.txt" of (text items 1 thru -2 of (path to me as string)) as alias to applications folder
    set Applescript's text item delimiters to prevTIDs
end tell
0

精彩评论

暂无评论...
验证码 换一张
取 消