apple-mac-os:macos-high-sierra:how-to-create-service-of-fast-transliteration-based-on-perl-script-in-macos-high-sierra
Различия
Показаны различия между двумя версиями страницы.
| Следующая версия | Предыдущая версия | ||
| apple-mac-os:macos-high-sierra:how-to-create-service-of-fast-transliteration-based-on-perl-script-in-macos-high-sierra [01.05.2018 14:49] – создано Алексей Максимов | apple-mac-os:macos-high-sierra:how-to-create-service-of-fast-transliteration-based-on-perl-script-in-macos-high-sierra [07.07.2023 06:58] (текущий) – Виталий Якоб | ||
|---|---|---|---|
| Строка 58: | Строка 58: | ||
| {{ : | {{ : | ||
| + | |||
| + | **[UPDATE: 19.01.2022]** | ||
| + | |||
| + | [[https:// | ||
| + | В случае использования Команды.app для работы необходимо разрешить выполнение скриптов в настройках, | ||
| + | |||
| + | <code AppleScript> | ||
| + | set theString to the clipboard | ||
| + | set countwords to count words of theString | ||
| + | |||
| + | if countwords is 3 then | ||
| + | |||
| + | set toTranslit to theString | ||
| + | |||
| + | set sourceList to {" | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | |||
| + | set targetList to {" | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | |||
| + | set ASTID to AppleScript' | ||
| + | repeat with i from 1 to count of sourceList | ||
| + | considering case | ||
| + | set toTranslit to findReplace(item i of sourceList, ¬ | ||
| + | item i of targetList, toTranslit) | ||
| + | end considering | ||
| + | end repeat | ||
| + | set AppleScript' | ||
| + | |||
| + | set results to toTranslit' | ||
| + | --return results | ||
| + | set the clipboard to results | ||
| + | tell application " | ||
| + | delay 0.1 | ||
| + | set the clipboard to theString | ||
| + | end if | ||
| + | |||
| + | --Обработчик | ||
| + | on findReplace(findText, | ||
| + | set AppleScript' | ||
| + | set sourceText to text items of sourceText | ||
| + | set AppleScript' | ||
| + | return sourceText as text | ||
| + | end findReplace | ||
| + | </ | ||
| + | |||
| ---- | ---- | ||
| Проверено на следующих конфигурациях: | Проверено на следующих конфигурациях: | ||
| - | ^ Версия ОС ^ | + | ^ Версия ОС |
| - | |Apple macOS High Sierra (10.13.4)| | + | | Apple macOS High Sierra (10.13.4) |
| + | | Apple macOS Mojave (10.14) | ||
| + | | Apple macOS Catalina (10.15) | ||
| + | | Apple macOS Monterey (12.0.1, Apple/ | ||
| ---- | ---- | ||
| {{: | {{: | ||
| - | {{tag> | + | {{tag> |
| ~~DISCUSSION~~ | ~~DISCUSSION~~ | ||
apple-mac-os/macos-high-sierra/how-to-create-service-of-fast-transliteration-based-on-perl-script-in-macos-high-sierra.1525186168.txt.gz · Последнее изменение: — Алексей Максимов