0
Я нашел этот скрипт для изменения прописных и строчных символов в сообщениях, но я хочу изменить этот код, чтобы заменить некоторую строку в тексте, например: «получено есть ", это сообщение будет изменено на" Я люблю поесть "или" :) "изменить на" :-) ".Applescript для замены сообщения, отправленного и полученного в приложении «Сообщения»
property lowercaseCharacters : "abcdefghijklmnopqrstuvwxyz"
property uppercaseCharacters : "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
on intercaps(str)
set theCharacters to characters of str
set theCount to 1
repeat with aChar in theCharacters
if (aChar is in uppercaseCharacters or aChar is in lowercaseCharacters) then
if (theCount mod 2) is equal to 1 then
set contents of aChar to character (offset of aChar in lowercaseCharacters) of uppercaseCharacters
else
set contents of aChar to character (offset of aChar in uppercaseCharacters) of lowercaseCharacters
end if
end if
set theCount to theCount + 1
end repeat
return theCharacters as string
end intercaps
using terms from application "Messages"
on message sent theMessage for theChat
return intercaps(theMessage)
end message sent
on message received theMessage from theBuddy for theChat
return intercaps(theMessage)
end message received
on chat room message received theMessage from theBuddy for theChat
return intercaps(theMessage)
end chat room message received
end using terms from