2011-12-11 57 views
0

變換錯誤我發現下面的AutoHotkey的片斷here粘貼文本而不支持格式的Unicode:將文本粘貼到不支持Unicode的格式。在AutoHotkey的

<^<+v::       ; Text–only paste from ClipBoard 
    Clip0 = %ClipBoardAll% 
    Transform, UC, Unicode   ; Save Unicode text 
    Transform, Clipboard, Unicode, %UC% 
    Send ^v      ; For best compatibility: SendPlay 
    Sleep 50      ; Don't change clipboard while it is pasted! (Sleep > 0) 
    ClipBoard = %Clip0%   ; Restore original ClipBoard 
    VarSetCapacity(Clip0, 0)  ; Free memory 
Return 

然而,當我的AutoHotkey_L最新版本上運行它,它與下面的錯誤抱怨:

Line 4:  Parameter #2 invalid. 

Line 4地方指的是線Transform, UC, Unicode ; Save Unicode text

這段代碼應該按照上面鏈接的註釋工作。任何想法爲什麼我得到這個錯誤?

回答

1

你安裝了哪個版本的AutoHotkey_L?在安裝過程中,當前版本會要求您在Unicode和ANSI之間進行選擇。如果您選擇了Unicode,那麼Transform命令沒有Unicode子命令。我猜是因爲這不需要。

AutoHotkey_L文檔爲Transform命令:

Unicode [, String]: (This command is not available in Unicode builds of AutoHotkey_L.) Retrieves or stores Unicode text on the clipboard. Note: The entire clipboard may be saved and restored by means of ClipboardAll, which allows "Transform Unicode" to operate without losing the original contents of the clipboard.

我不使用Unicode版本,所以我無法測試

,但我假設在AutoHotkey_L的Unicode版本的任何文本檢索從剪貼板將已經是Unicode所以這應該工作:

<^<+v::       ; Text–only paste from ClipBoard 
    Clip0 = %ClipBoardAll% 
    Clipboard = %Clipboard% ; Convert clipboard text to plain text. 
    Send ^v      ; For best compatibility: SendPlay 
    Sleep 50      ; Don't change clipboard while it is pasted! (Sleep > 0) 
    ClipBoard = %Clip0%   ; Restore original ClipBoard 
    VarSetCapacity(Clip0, 0)  ; Free memory 
Return 
相關問題