How does one copy (duplicate) and move a file from the same folder as the AppleScript code?
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
精彩评论