0
我發現了一個下面的AppleScript,它查找並替換了......但是,在這種情況下,我不想用「401」代替,而是希望它替換剪貼板上的內容。查找並粘貼Apple腳本
所以我試圖把一樣的東西:set stringToReplace to keystroke "v" using command down
...但是,這並不工作
下面是代碼(線等預計年底卻發現標識符):
on run {input, parameters}
set stringToFind to "404"
set stringToReplace to "401"
set theFile to choose file
set theContent to read theFile as «class utf8»
set {oldTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, stringToFind}
set ti to every text item of theContent
set AppleScript's text item delimiters to stringToReplace
set newContent to ti as string
set AppleScript's text item delimiters to oldTID
try
set fd to open for access theFile with write permission
set eof of fd to 0
write newContent to fd as «class utf8»
close access fd
on error
close access theFile
end try
return input
end run