在 OS X 上插入特殊字元最簡單的方法是什麼?

在 OS X 上插入特殊字元最簡單的方法是什麼?

我想在溝通中使用「豎起大拇指」unicode 表情符號。

豎起大拇指

有沒有一種簡單的方法可以在不打開特殊字元調色板(例如某些 AppleScript)的情況下執行此操作?一些瘋狂的 unicode 鍵序列(我研究過這個,它看起來太複雜了,而且你必須改變你的鍵盤佈局)?快捷鍵的內建實用程式?快速鍵的第三方實用程式?

答案1

最簡單的選擇之一就是使用文字擴充器。您也可以在文字檔案中配置縮寫,然後將其作為群組匯入。

也可以將字元新增至按住彈出視窗

我用過快速腳本為該腳本指定快捷方式:

try
    set old to the clipboard as record
end try
try
    tell application "System Events"
        key code 123 using {option down, shift down}
        keystroke "c" using command down
    end tell
    delay 0.05
    set input to the clipboard
    if input contains return then error
    set p1 to read POSIX file "/Users/lauri/Notes/snippets.txt" as «class utf8» using delimiter linefeed
    set p2 to read POSIX file "/Users/lauri/Projects/unicode/html_entities.txt" as «class utf8» using delimiter linefeed
    repeat with p in p1 & p2
        considering case
            if p starts with (input & " ") then
                set the clipboard to text ((offset of space in p) + 1) thru -1 of p
                tell application "System Events" to keystroke "v" using command down
                delay 0.05
                exit repeat
            end if
        end considering
    end repeat
end try
try
    set the clipboard to old
end try

html_entities.txt是用於 HTML 字元引用的縮寫清單。

您也可以建立~/Library/KeyBindings/並儲存一個屬性列表,如下所示預設KeyBinding.dict。重新開啟應用程式後,⌥A 應插入α.但insertText:似乎不適用於U+10000其上方的字元。

{
    "~a" = (insertText:, "α");
}

相關內容