Search code examples
autohotkeyclipboard

Autohotkey showing clipboard content


I don't know what happens but I cant get the AHK to use show clipboard content.

#5::MsgBox, Clipboard / Error: Function calls require a space or "(".  Use comma only 
between parameters.
#5::MsgBox % Clipboard / Error: Missing ending "%"
#5::MsgBox %Clipboard% / Warning: This variable appears to never be assigned a value.
#5::MsgBox, %Clipboard% / Error: Function calls require a space or "(".  Use comma only 
between parameters.

Originally I want to reuse the clipboard content to print this: e.g console.log('clipboard ', clipboard);

I always get errors, I had to reduce this problem just showing clipboard only and I always get error as well, Im total confused, why did I do wrongly ?

Thanks in advance.

Cs.


Solution

  • The built-in variable "Clipboard" of AHK v1 is replaced in AHK v2 by "A_Clipboard". It can also be used in AHK v1.

    AHK v1:

    #Requires AutoHotkey v1.1
    
    #5::MsgBox % Clipboard
    ; or
    #6::MsgBox % A_Clipboard
    

    AutoHotkey v2 exclusively uses expression syntax and functions. Variable names in expressions are not enclosed in percent signs.

    AHK v2:

    #Requires AutoHotkey v2.0
    
    #5::MsgBox A_Clipboard
    ; or
    #6::MsgBox(A_Clipboard)