2011-12-11 54 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 
相关问题