Method: AutoItX3.cliptext

Defined in:
lib/AutoItX3/misc.rb

.cliptextObject

Reads the Windows clipboard.

Return value

The text saved in the clipboard, encoded in UTF-8.

Example

puts AutoItX3.cliptext #=> I love Ruby!

Remarks

Returns the text saved in the clipboard. It will be truncated at the AutoItX3::BUFFER_SIZE - 1th character or at a NUL character.

If the clipboard doesn’t contain text, this method returns an empty string.



117
118
119
120
121
122
123
# File 'lib/AutoItX3/misc.rb', line 117

def cliptext
  @functions[__method__] ||= AU3_Function.new("ClipGet", 'PL')
  cliptext = " " * BUFFER_SIZE
  cliptext.wide!
  @functions[__method__].call(cliptext, cliptext.size - 1)
  cliptext.normal.strip
end