我目前正在编写一个超级简单的脚本,我需要在变量中找到并替换文本(特别是在放到AppleScript上的项目的路径中.)这是我目前的情况:
on open {dropped_items}
tell application "Finder" to set filePathLong to the POSIX path of dropped_items as text
on replaceText(find, replace, subject)
set prevTIDs to text item delimiters of AppleScript
set text item delimiters of AppleScript to find
set subject to text items of subject
set text item delimiters of AppleScript to replace
set subject to "" & subject
set text item delimiters of AppleScript to prevTIDs
return subject
end replaceText
get replaceText("/mpc/mayors1", "/ifs/disk1", filePathLong)
display dialog subject
end open …Run Code Online (Sandbox Code Playgroud)