Софт-Архив

Qclipboard img-1

Qclipboard

Рейтинг: 4.4/5.0 (1872 проголосовавших)

Категория: Windows: другое

Описание

Clipboard - это

clipboard это: Смотреть что такое "clipboard" в других словарях:

Clipboard — Clipboard … Deutsch Worterbuch

clipboard — clip?board [?kl?pb??d ? b??rd] noun [countable] 1. a small flat board with a piece of metal or plastic on top for holding pieces of paper so that you can write on them 2. COMPUTING a part of a computer memory that stores sections of text while… … Financial and business terms

clipboard — n. a small writing board with a clip attached at the top for holding papers. [WordNet 1.5] … The Collaborative International Dictionary of English

clipboard — 1907, from CLIP (Cf. clip) (2) + BOARD (Cf. board) (n.1). Portable board with a hinged clip at the top to hold papers … Etymology dictionary

clipboard — (izg. klipbord) m DEFINICIJA inform. dio memorije predviden za privremeno spremanje podataka i njihov transfer medu raznim programima ETIMOLOGIJA engl … Hrvatski jezicni portal

clipboard — > NOUN ? a small board with a spring clip at the top, used for holding papers and providing support for writing … English terms dictionary

clipboard — ? clipboard [klip?bord? ] n. a portable writing board with a hinged clip at the top to hold papers … English World dictionary

Clipboard — For the clipboard used in software, see Clipboard (software). A wooden clipboard A clipboard is a thin, rigid board with a clip at the top for holding paper in place. A clipboard is typically used to support paper with one hand while writing on… … Wikipedia

Clipboard — Cli?p|board ?[ b?:d] n. 15? 1. Klemmbrett fur Notizblatter 2. Gestell mit plakatgro?en Blattern fur Besprechungen u. Konferenzen ? Plane mit Filzstift auf ein Clipboard zeichnen [<engl. clip „Klammer“ + board „Brett“] * * * Clipboard   [engl.] … Universal-Lexikon

clipboard — [[t]kl??pb??(r)d[/t]] clipboards 1) N COUNT A clipboard is a board with a clip at the top. It is used to hold together pieces of paper that you need to carry around, and provides a firm base for writing. 2) N COUNT In computing, a clipboard is a… … English dictionary

clipboard — UK [?kl?p?b??(r)d] / US [?kl?p?b?rd] noun [countable] Word forms clipboard. singular clipboard plural clipboards 1) a small board that you can attach papers to, so that you can write on them easily while you are moving around 2) computing the… … English dictionary

  • Буфер обмена. Джесси Рассел. High Quality Content by WIKIPEDIA articles!Бу?фер обме?на (англ. clipboard) — промежуточное хранилище данных, предоставляемое программным обеспечением и предназначенное для переноса или… Подробнее Купить за 1125 руб
  • CD-ROM. X-Translator: POCKET 2. Переводчик для КПК и коммуникаторов англо-русский, русско-английский. X-Translator: Pocket 2– система перевода текстов для КПК и коммуникаторов на платформе Windows Mobile 2003 и Windows Mobile 5.0/6.0. Продукт обеспечивает: Перевод текста, скопированного… Подробнее Купить за 146 руб
  • CD-ROM. X-Translator: POCKET 2. Переводчик для КПК и коммуникаторов англо-русский, русско-английский. X-Translator: Pocket 2– система перевода текстов для КПК и коммуникаторов на платформе Windows Mobile 2003 и Windows Mobile 5.0/6.0. Продукт обеспечивает: Перевод текста, скопированного… Подробнее Купить за 146 руб

Видео

Другие статьи, обзоры программ, новости

Accessing the system clipboard - Vim Tips Wiki

Accessing the system clipboard

Please review this tip:

  • This tip was imported from vim.org and needs general review .
  • You might clean up comments or merge similar tips .
  • Add suitable categories so people can find the tip.
  • Please avoid the discussion page (use the Comments section below for notes).
  • If the tip contains good advice for current Vim, remove the <> line.

This tip is very similar to the following:

These tips need to be merged – see the merge guidelines.

created  2005 · complexity  basic · author  JimD · version  6.0

One of the traditional disconnects between vi and modern graphical environments has been using mouse-driven copy/paste between a terminal or command prompt window, and any other application (for example, a web browser).

Vim has extended vi to allow use of the * register as a reference to the system clipboard. So we can use normal mode commands like: "*dd or 1G"*yG to copy things into the * register and "*p to paste text from it. We can also use this * register with the ex yank command, so :%y * will accomplish the same goal as gg"*yG (copy all text into the system clipboard so it can be pasted into an X or MS Windows application).

The * register acts just like any of the normal (single letter) registers in vi except that it also refers to the system clipboard in X11 or MS Windows.

I've also found that it's much faster and more reliable than pasting a large body of text into Vim through an xterm. Normally I run Vim under the Linux screen utility and any more than one screen full of text is often corrupted, and large selections (>10KB) take several seconds of gnashing and flashing to finish pasting (almost always corrupted). By contrast, pasting 100KB text using "*p is very reliable and fast.

I searched though the tips and found only a few passing references to this feature: VimTip71 (implies it's a feature of gvim, but I find it works in console Vim just fine under Linux; I only use gvim under MS Windows). VimTip771 and VimTip964 refer to an extra utility named xclip which is only for X11 and seems to be completely unnecessary for Vim using the * register), and VimTip960 (misses the point but the comments mention it a few times).

VimTip21 is spot on but the title suggests it's for MS Windows only. It also mentions that we can change out settings so the "anonymous" register is aliased to the * register using:

Note: in vim 7.3.74 and higher you can set clipboard=unnamedplus to alias unnamed register to the + register, which is the X Window clipboard.

VimTip432 and VimTip600 use the * register in some native Vim code (using @*) without explaining it in general. VimTip448 also uses it (for converting hex to decimal) but explains it in passing. VimTip478 uses it in a function for copying the results of a :g search into the * register. VimTip687 suggests that Mac OS X doesn't implement the * register (yet?) but suggests a workaround using the pbcopy and pbpaste utilities. VimTip876 also makes passing reference to it.

There are several tips for copying the current filename into the clipboard including: VimTip432. VimTip891. VimTip600 (most of the fuss is resolving forward slashes and backslashes for MS Windows paths).

Getting Vim to work with the X11 clipboard can be a struggle, at least when you like to run Vim in a terminal. The GUI version of Vim always has clipboard support, however, if you like to use Vim from a terminal, you will have to check for X11-clipboard support.

From the console, type:

If you see " +xterm_clipboard ", you are good to go. If it's " -xterm_clipboard ", you will need to look for a version of Vim that was compiled with clipboard support. I have found that the Vim that ships with Ubuntu has clipboard support (not vim-tiny, you need vim-gnome or vim-gtk), but the one with Redhat/CentOS does not.

If you are running Redhat/CentOS, you can install the vim-X11 package (if you have gvim then this is already installed). This provides the vimx command, which is a console version of Vim with X11-clipboard support. Or if you are running Debian(only test on 7.0), installing vim-gnome package fixs the problem. I like aliasing Vim to vimx by adding this line to my .bashrc/.cshrc:

If you are running Gentoo, emerge vim with the 'X' USE flag. For instance, adding this line to /etc/portage/package.use:

Some basic clipboard commands:

  • "+2yy – copy two lines to X11 clipboard
  • "+dd – cut line to X11 clipboard
  • "+p – paste X11 clipboard
See also Edit Comments Edit

Under Windows, the * and + registers are equivalent. For X11 systems, though, they differ. For X11 systems, * is the selection, and + is the cut buffer (like clipboard).

Text selected, or otherwise highlighted in one X11 app is available in the selection buffer, and text explicitly copied or cut is available in the cut buffer.

All my inter-window copy & paste to gvim is handled by the <F7> key. This works for all OSes only for gvim.

The + and * registers do not work running Vim under cygwin without an X session (for instance running Vim directly from a cmd or rxvt window). They also don't work under Mac OS X using Vim from the command line (via Terminal.app or iTerm.app). This should be documented (as should workarounds).

For such systems, fakeclip plugin provides comprehensive and extensible emulation for the clipboard registers.

in response to above comment (cygwin vim sans X session), as of the software versions below, there doesn't seem to be any problems using the "* register in or outside of rxvt, in a cmd window:

WinXP (SP3)

cygwin (2.831)

rxvt (20050409-21)

vim (7.3.1314-1)

If you're having trouble with GVIM on Ubuntu, and it doesn't seem to be doing what everybody is saying it should, try closing it completely and reopening. It's supposed to "just work" in the case of copy-paste integration with the system clipboard, especially if you use GVIM's GUI buttons or menus. However, sometimes it just stops working, and you have to close and reopen.

The Ubuntu vim-gtk package contains the +xterm_clipboard option, while the standard vim package does not.

If for some reason your version of vim under Unix-like system has no support for clipboard, you can use a handy utility called xsel. Xsel lets you manipulate X selections (check man xsel for more info). To work around the lack of clipboard I use following mappings:

So, to paste from X clipboard, you use :r!xsel -p|-s|-b depending which X clipboard you want to access. To copy, use :w!xsel -i -p|-s|-b.

This was recently added, but there is no indication why it is useful or needed. I have moved it here for now because to my knowledge the normal clipboard access commands should work and are much more desireable.

--Fritzophrenic 17:30, November 8, 2010 (UTC)

I am running ubuntu 10.04 with vim-gtk. The * register works as described for gvim but not the command line. vim --version does show the " +xterm_clipboard" option. This is version 7.2.

I had a similar issue on Ubuntu 14.04. It turns out the default clipboard setting is "autoselect,exclude:cons\|linux" and I was changing it with set clipboard+=unnamedplus. which turned it into "autoselect,exclude:cons\|linux,unnamedplus". However, according to the help page for clipboard-exclude. the exclude option must come last. Changing my code to set clipboard^=unnamedplus solved the problem by prepending the unnamedplus setting, rather than appending it. BTW, I have Vim GNOME 7.4.52 from the Ubuntu repositories, and clipboard=unnamed uses the X clipboard, while clipboard=unnamedplus uses the (GNOME) System Clipboard. --LeahCim (talk ) 02:01, September 1, 2014 (UTC)

I have found using the autocutsel package on X11 in conjunction with set clipboard=unnamed provides a seamless experience.

Simple workaround for X clipboards Edit

There is a convenient workaround to create a few commands for pasting/copying selections into/out of various X11 clipboards with `xsel`.

With this code blob dumped in your

/.vimrc you can do the following

and your selected text will be copied into one of X's 3 default clipboards.

there are 6 commands, 3 for pasting, 3 for copying, and each command represents a buffer.

DISPLAY environment variable on Linux systems Edit

Make sure your DISPLAY environment variable is set appropriately - otherwise vim can not connect to your x-session to access the clipboard.

To check run:

Workaround using x11 minimum packages (under Linux) Edit

If nothing work and you would like to copy from vim (under xterm) to leafpad, you may use this add-on to your

Press F9, and it will copy to the x11 clipboard.

I hope that it may help you.

Workarounds for xterm Edit

If :version shows " +xterm_clipboard ", but using the clipboard still does not work, try using other system tools as a workaround. For example, you can search for a clipboard.sh script which can be used like ' cat a.txt | clipboard ' to copy the contents of file a.txt to the system clipboard. When using kubuntu, the system clipboard is managed by 'Klipper', you can use 'Klipper' shortcut to paste anything to the system clipboard from anywhere because its shortcut has the highest precedence. --Changc11, October 10, 2013

Has a case like this been discussed at the vim_use mailing list? If clipboard support is provided by Vim, and if the versions of Vim and the system are not excessively old, the clipboard should work. This idea is better as a comment until something more conclusive is known. JohnBeckett (talk ) 10:27, October 13, 2013 (UTC)

Using gnome-terminal Edit

If you are using vim inside gnome-terminal the default copy/paste shortcuts are Shift-Control-C (copy), and Shift-Control-V (paste).

Qt 4

Переопределённые защищённые функции
    7 защищенных функций, унаследованных от QObject
Дополнительные унаследованные члены
    1 свойство, унаследованное от QObject 1 открытый слот, унаследованный от QObject 5 статических открытых членов, унаследованных от QObject 7 защищенных функций, унаследованных от QObject
Подробное описание

The QClipboard class provides access to the window system clipboard.

The clipboard offers a simple mechanism to copy and paste data between applications.

QClipboard supports the same data types that QDrag does, and uses similar mechanisms. For advanced clipboard usage read Drag and Drop .

There is a single QClipboard object in an application, accessible as QApplication::clipboard ().

QClipboard features some convenience functions to access common data types: setText () allows the exchange of Unicode text and setPixmap () and setImage () allows the exchange of QPixmaps and QImages between applications. The setMimeData () function is the ultimate in flexibility: it allows you to add any QMimeData into the clipboard. There are corresponding getters for each of these, e.g. text (), image () and pixmap (). You can clear the clipboard by calling clear ().

A typical example of the use of these functions follows:

Notes for X11 Users
  • The X11 Window System has the concept of a separate selection and clipboard. When text is selected, it is immediately available as the global mouse selection. The global mouse selection may later be copied to the clipboard. By convention, the middle mouse button is used to paste the global mouse selection.
  • X11 also has the concept of ownership; if you change the selection within a window, X11 will only notify the owner and the previous owner of the change, i.e. it will not notify all applications that the selection or clipboard data changed.
  • Lastly, the X11 clipboard is event driven, i.e. the clipboard will not function properly if the event loop is not running. Similarly, it is recommended that the contents of the clipboard are stored or retrieved in direct response to user-input events, e.g. mouse button or key presses and releases. You should not store or retrieve the clipboard contents in response to timer or non-user-input events.
  • Since there is no standard way to copy and paste files between applications on X11, various MIME types and conventions are currently in use. For instance, Nautilus expects files to be supplied with a x-special/gnome-copied-files MIME type with data beginning with the cut/copy action, a newline character, and the URL of the file.
Notes for Mac OS X Users

Clipboard - Lazarus wiki

For use of simple text Clipboard offer property AsText which can be used for reading an writing plain text.

Reading text:

Clipboard is a TClipboard variable and the Clipbrd unit should be added in the uses clause in order to use the variable:

Text oriented components

Some visual components like TEdit, TMemo, TStringGrid, TLabeledEdit, TMaskEdit, TSpinEdit and TFloatSpinEdit have ability to select a part of contained text and offer additional functionality for handling clipboard operations on selected text.

HTML source

Example of reading HTML source from clipboard:

Write html source to clipboard. This can be done with AddFormat either using TStream or memory Buffer.

Not all applications support the 'text/html' mime type. Microsoft operating systems and applications instead support 'HTML Format' and the required contents of the clipboard are specified here:

(if URL changes, Document title: HTML Clipboard Format. and is part of the MSHTML Editing documentation)

This specification contains the requirement for the header to specify the length of the header, which can be annoying to calculate given that the count itself changes the number of characters. The easiest way to resolve this is to the output the various counts and positions as 10 digits, and then use leading zeros as shown below.

As the Clipboard can support multiple formats, you can place SimpleText, 'text/html' and 'HTML Format' items at the same time.

Clipboard -Autohotkey

Clipboard -Autohotkey Clipboard является встроенной переменной, повторяющей содержимое клипборда Windows, если оно ограничивается текстом. В противоположность ей, ClipboardAll полностью повторяет клипборд, включая картинки и форматирование.

Clipboard является встроенной переменной, повторяющей содержимое клипборда Windows, если оно ограничивается текстом. В противоположность ей, ClipboardAll полностью повторяет клипборд, включая картинки и форматирование.

Каждая строка текста из Clipboard обычно заканчивается кодами carriage return и linefeed (CR+LF), которые в скрипте записываются как `r`n. Файлы (например, скопированные из окна Проводника с помощью Control-C) рассматриваются как текст: т.е. они автоматически преобразуются в их имена (с полными путями) при обращении скрипта к Clipboard. Выделить имя каждого из нескольких файлов можно так:

Чтобы расставить имена файлов по алфавиту, воспользуйтесь командой Sort. Имена файлов из клипборда в файл сохранит команда: FileAppend, %clipboard%`r`n, C:\My File.txt. Слово #ClipboardTimeOut определит, как долго скрипт будет ожидать открытия клипборда - например, когда с клипбордом работает другое приложение.

Простые примеры :

Clipboard API and events

Clipboard API and events W3C Working Draft 15 December 2015

This document describes APIs for clipboard operations such as copy, cut and paste in web applications.

Status of This Document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.

This document was published by the Web Platform Working Group as a Working Draft. If you wish to make comments regarding this document, please send them to public-webapps@w3.org (subscribe. archives ). All comments are welcome.

Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.

This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

This document is governed by the 1 September 2015 W3C Process Document.

Table of Contents 1. Conformance

As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.

The key word SHOULD is to be interpreted as described in [ RFC2119 ].

2. Introduction

This section is non-normative.

This specification defines the common clipboard operations of cutting, copying and pasting, in such a way that they are exposed to Web Applications and can be adapted to provide advanced functionalities. Its goal is to provide for compatibility where possible with existing implementations.

3. Use Cases

This section is non-normative.

There are many use cases for being able to change the default clipboard operations (cut/copy/paste). We have collected a few samples to demonstrate possible uses, although these may not all be supported by this specification.

3.1 Rich content editing

When copying text which contains hyperlinks or other structure, it is often useful to be able to reformat the content to preserve important information.

3.2 Graphics with built-in semantics

In order to make web applications which allow the manipulation of rich text, or of graphic content such as SVG, it is useful to provide a mechanism that allows for copying more than just the rendered content.

3.3 Mathematical information

With content such as mathematics, simply copying rendered text and pasting it into another application generally leads to most of the semantics being lost. MathML often needs to be transformed to be copied as plain text, for example to make sure "to the power of" is shown with the caret "^" sign in a formula plain-text input. The XML source could also be placed in the clipboard with the appropriate transformation occurring at paste time.

4. APIs from other specifications

The following items are defined in the HTML Editing APIs specification [ HTMLEA ]

5. Terminology

The term editable context means any element that is either an editing host. a textarea element, or an input element with its type attribute set to any of text. search. tel. url. email. password or number .

6. Determining UI state

The user agent typically has internal logic for determining whether copy, cut and paste commands in the UI are enabled. This logic depends on factors like whether the cursor is in an editable context (for paste commands) or whether there is a selection (for copy commands).

Web applications need a way to override this logic, because they need to be able to enable commands even when the user agent's native logic concludes that the commands should not be available. The before* events can be used to override the internal logic.

6.1 Events 6.1.1 beforecopy event

If the implementation has user interface controls that users can use to initiate a copy operation, the user agent should determine what state such controls should be in by firing a beforecopy event before the control is shown to the user (i.e. in a menu). If the event is canceled, the control's state is set to enabled. If the event is not canceled, the implementation uses its built-in logic to set the control's state, for example by disabling any 'copy'-related UI controls if there is no selection. The event bubbles and is cancelable.

6.1.2 beforecut event

If the implementation has user interface controls that users can use to initiate a cut operation, the user agent should determine what state such controls should be in by firing a beforecut event before the control is shown to the user (i.e. in a menu). If the event is canceled, the control's state is set to enabled. If the event is not canceled, the implementation uses its built-in logic to set the control's state, for example by disabling any 'cut'-related UI controls if there is no selection in an editable context. The event bubbles and is cancelable.

6.1.3 beforepaste event

If the implementation has user interface controls that users can use to initiate a paste operation, the user agent should determine what state such controls should be in by firing a beforepaste event before the control is shown to the user (i.e. in a menu). If the event is canceled, the control's state is set to enabled. If the event is not canceled, the implementation uses its built-in logic to set the control's state, for example by disabling any 'paste'-related UI controls if focus is not in an editable context. The event bubbles and is cancelable.

6.2 Processing model for before* events

At any time, including before a command will be shown to the user, or when the user presses a shortcut combination, or otherwise interacts with the document, the user agent may use the steps below for checking if a given command should be enabled.

To fire a beforecopy, beforecut or beforepaste event of type type :

  1. Let the data transfer be a DataTransfer object [ HTMLLS ]
  2. Set the associated DataTransfer object's drag data store mode flag to read-only
  3. If the type is beforepaste For each part on the OS clipboard of a type listed in the mandatory data types list, add the corresponding MIME type to the data transfer 's types list
  4. Let event target be the focused element, or the body element if no other element has focus.
  5. Dispatch an event using the ClipboardEvent interface, with its type attribute initialized to type. its isTrusted attribute initialized to trusted. its bubbles attribute set to true. its cancelable attribute set to true. and its clipboardData attribute initialized to data transfer. at event target .
  6. If the event was not canceled Use the user-agent's built-in logic for determining the command's state Otherwise, if the event was canceled Set the command's state to enabled

These events can not be used to disable UI controls that would otherwise be enabled. The use case for beforecopy, beforecut and beforepaste events is to enable UI elements that would otherwise be disabled, by allowing the script to indicate that it will handle clipboard operations even though there is no selection or editable context .

7. Clipboard actions and events

This section defines clipboard actions and events and the processing model for event dispatch.

7.1 Actions

Each action has two flags called script-triggered and script-may-access-clipboard .

The script-triggered flag is set if the action runs because of a script, for example a document.execCommand() call. Future scripting APIs that interact with the clipboard should also use these actions, and the script-triggered flag must be set accordingly.

The script-may-access-clipboard flag is set as follows:

If action is copy or cut and the script thread is allowed to modify the clipboard Set the action's script-may-access-clipboard flag If action is paste and the script thread is allowed to read from clipboard set the action's script-may-access-clipboard flag.

7.1.1 The copy action

When the user initiates a copy action, the implementation fires a clipboard event named copy. If the event is not canceled, the selected data will be copied to the clipboard.

The current selection is not affected. The event bubbles and is cancelable.

A script which uses the event.clipboardData API to control what ends up on the clipboard, needs to cancel the event. Otherwise, the data the script intends to place on the clipboard will be ignored.

If there is no selection, the clipboard is not modified except if the script has added entries in the DataTransferItemList. for example by calling the setData() method, and canceled the event.

The copy action consists of the following steps:

  1. If the script-triggered flag is set If the script-may-access-clipboard flag is unset Return false from the copy action, terminate this algorithm
  2. Fire a clipboard event named copy
  3. If the event was not canceled Copy the selected contents, if any, to the clipboard. Implementations should create alternate text/html and text/plain clipboard formats when content in a web page is selected. else, if the event was canceled Call the writing contents to the clipboard algorithm, passing on the DataTransferItemList list items. a clear-was-called flag and a types-to-clear list.
  4. Return true from the copy action
7.1.2 The cut action

When the user initiates a cut action, the implementation fires a clipboard event named cut. In an editable context. if the event is not canceled the action will place the selected data on the clipboard and remove the selection from the document.

The event bubbles and is cancelable.

The cut event fires before the selected data is removed. When the cut operation is completed, the selection is collapsed.

In a non-editable context. or if there is no selection, the cut action does nothing. The implementation fires the event regardless. In this case nothing, the clipboard is not modified except if the script has added entries in the DataTransferItemList and the event is canceled.

Any script which uses the event.clipboardData API to control what the cut event will write to the clipboard also needs to cancel the event. Otherwise, the data the script intends to place on the clipboard will be ignored.

The cut action consists of the following steps:

  1. If the script-triggered flag is set If the script-may-access-clipboard flag is unset Return false from the cut action, terminate this algorithm
  2. Fire a clipboard event named cut
  3. If the event was not canceled If there is a selection in an editable context where cutting is enabled
    1. Copy the selected contents, if any, to the clipboard. Implementations should create alternate text/html and text/plain clipboard formats when content in a web page is selected.
    2. Remove the contents of the selection from the document and collapse the selection.
    3. Queue tasks to fire any events that should fire due to the modification, see interaction with other events for details.
    Else, if there is no selection or the context is not editable Return false Else, if the event was canceled Call the writing contents to the clipboard algorithm, passing on the DataTransferItemList list items. a clear-was-called flag and a types-to-clear list.
  4. Return true from the cut action
7.1.3 The paste action

When a user initiates a paste action, the implementation fires a clipboard event named paste. The event fires before any clipboard data is inserted.

The event bubbles and is cancelable.

If the cursor is in an editable element, the paste action will insert clipboard data in the most suitable format (if any) supported for the given context.

The paste action has no effect in a non-editable context. but the event fires regardless.

When pasting, the drag data store mode flag is read-only. hence calling setData() from a paste event handler will not modify the data that is inserted, and not modify the data on the clipboard.

For the paste action, the script-may-access-clipboard flag depends on an implementation-specific permission mechanism for determining what sites or apps may read from the clipboard. When a paste action is triggered by a script, the implementation must not make clipboard contents available without the user's permission. If the permission has not already been granted, the permission prompt must include the hostname of the document associated with the script thread.

The paste action consists of the following steps:

  1. If the script-triggered flag is set If script-may-access-clipboard is unset Return false from the paste action, terminate this algorithm
  2. Fire a clipboard event named paste
  3. If the event was not canceled If there is a selection or cursor in an editable context where pasting is enabled
    1. Insert the most suitable content found on the clipboard, if any, into the context.
    2. Queue tasks to fire any events that should fire due to the modification, see interaction with other events for details.
    Else Return false Else, if the event was canceled Return false
  4. Return true from the action
7.2 Processing model for event dispatch

To fire a clipboard event of type e ,

  1. Let clear-was-called be false
  2. Let types-to-clear be an empty list
  3. Let clipboard-entry be the sequence number of the current clipboard content, or null if the OS clipboard does not support sequence numbers
  4. Let trusted be true if the event is generated by the user agent, false otherwise
  5. Set target as follows: If the context is editable: Let target be the element that contains the start of the selection in document order, or the body element if there is no selection or cursor. Else, if the context is not editable Let target be the focused node, or the body element if no node has focus.
  6. If e is paste

If trusted is true. or the implementation is configured to give script-generated events read access to the OS clipboard

For each part on the OS clipboard, carry out these steps:

If the current clipboard part contains plain text:
  1. Ensure the text is in the encoding the scripting engine uses internally
  2. Add one entry for the text to the DataTransferItemList with drag data item kind set to string and drag data item type string set to text/plain
If the current clipboard part represents file references:
  1. Determine MIME type of referenced files
  2. Add one entry per file reference to the DataTransferItemList with drag data item kind set to file and drag data item type string set to the corresponding MIME type, or application/octet-stream if the file's type is unknown.
If the current clipboard part contains HTML- or XHTML-formatted text, according to the operating system's convention for describing such clipboard formats

If the implementation supports pasting HTML, the implementation must process the markup according to the following steps:

  1. Add one entry to the DataTransferItemList with drag data item kind set to Plain Unicode string. drag data item type string set to text/html or application/xhtml+xml accordingly. Let mainPartIndex be the index of this entry in the DataTransferItemList .
  2. Extract the markup from the clipboard and use the relevant parser to construct a DOM tree
  3. If the markup's source URL is known, resolve all relative URLs in HREF and SRC attributes using the source URL as base URL, and set the respective attributes to the resolved absolute URL
  4. If the markup's origin is from a local application, check whether there are references to local files and/or other parts of the OS clipboard's contents. If such references are found, references to sub-parts must be replaced by content-id references using the cid: URL scheme [ RFC2392 ]. To do so, process each attribute referencing a local file or clipboard part according to the following steps:

Are these steps necessary? Do we know about native (platform) clipboard implementations that support multiple parts with internal references?

This feature is at risk because it's unclear whether it is required, and because it's hard to test in a cross-platform way.

  1. Let itemNumber be the number of items on the DataTransferItemList

Choose the appropriate steps from this list:

If the DataTransferItemList of the current DataTransfer object already contains an entry for the referenced file or clipboard part set itemNumber to the index of the existing entry Otherwise
  1. Add a new entry to the DataTransferItemList with index set to itemNumber. drag data item kind set to "file", and drag data item type string set to the MIME type of the file or clipboard part if known, or application/octet-stream if the file's type is unknown.
  2. Let the new entry's internal file name be the file name part of the HTML attribute contents
  3. Let the new entry's last modified date be the timestamp of the referenced file or 0 if the entry references a clipboard part
  • Update the DOM attribute that referenced the local file or clipboard part to contain the string 'cid:' followed by itemNumber .
  • Serialize the processed DOM and update the DataTransferItemList entry referenced by mainPartIndex with the resulting HTML code
  • If the current clipboard part contains data in another supported binary or text-based format.
    1. Determine the MIME type of the data
    2. Add one entry to the DataTransferItemList with drag data item kind set to file. drag data item type string set to the corresponding MIME type

    Update the files property to match entries in the DataTransferItemList .

    Update the types property to match entries in the DataTransferItemList .

    If e is copy or cut

  • Dispatch an event named e which bubbles and is cancelable and which uses the ClipboardEvent interface, with isTrusted set to trusted. at target.

    Implementation requirements for access to data during event dispatch are defined in [ HTMLLS ]. Some additional clipboard event-specific processing rules are given below:

  • Clipboard and ClipboardAll

    Clipboard and ClipboardAll

    Clipboard is a built-in variable that reflects the current contents of the Windows clipboard if those contents can be expressed as text. By contrast, ClipboardAll contains everything on the clipboard, such as pictures and formatting.

    Each line of text on Clipboard typically ends with carriage return and linefeed (CR+LF), which can be expressed in the script as `r`n. Files (such as those copied from an open Explorer window via Control-C) are considered to be text: They are automatically converted to their filenames (with full path) whenever Clipboard is referenced in the script. To extract the files one by one, follow this example:

    To arrange the filenames in alphabetical order, use the Sort command. To write the filenames on the clipboard to a file, use FileAppend. %clipboard%`r`n, C:\My File.txt. To change how long the script will keep trying to open the clipboard -- such as when it is in use by another application -- use #ClipboardTimeOut .

    Basic examples:

    Using ClipWait to improve script reliability:

    ClipboardAll (saving and restoring everything on the clipboard)

    ClipboardAll contains everything on the clipboard (such as pictures and formatting). It is most commonly used to save the clipboard's contents so that the script can temporarily use the clipboard for an operation. When the operation is completed, the script restores the original clipboard contents as shown below:

    ClipboardAll may also be saved to a file (in this mode, FileAppend always overwrites any existing file):

    To later load the file back onto the clipboard (or into a variable), follow this example:

    ClipboardAll is blank when used in ways other than those described above. In addition, ClipboardAll is not supported inside comma-separated expressions ; that is, it should be assigned on a line by itself such as ClipSaved := ClipboardAll .

    Variables to which ClipboardAll has been assigned are in binary format and thus will appear as gibberish when displayed with MsgBox or similar. Also, altering a binary-clipboard variable (by means such as StringReplace ) will revert it to a normal variable, resulting in the loss of its clipboard data. In v1.0.46+, binary-clipboard variables may be passed to functions by value (formerly they only worked ByRef ).

    If ClipboardAll cannot retrieve one or more of the data objects (formats) on the clipboard, they will be omitted but all the remaining objects will be stored.

    A variable containing clipboard data can be copied to another variable as in this example: ClipSaved2 := ClipSaved .

    ClipWait may be used to detect when the clipboard contains data (optionally including non-text data).

    StrLen / StringLen may be used to discover the total size of a variable to which ClipboardAll has been assigned. However, to get the size in bytes on Unicode versions of AutoHotkey, the length must be multiplied by 2. A_IsUnicode can be used to support ANSI and Unicode versions, as in this example: size := StrLen(ClipSaved) * (A_IsUnicode. 2. 1) .

    Variables to which ClipboardAll has been assigned can be compared to each other (but not directly to ClipboardAll ) by means of the <> and = operators. In the following example, the length of each variable is checked first. If that is not enough to make the determination, the contents are compared to break the tie:

    Saving ClipboardAll to a variable is not restricted by the memory limit set by #MaxMem .

    A saved clipboard file internally consists of a four-byte format type, followed by a four-byte data-block size, followed by the data-block for that format. If the clipboard contained more than one format (which is almost always the case), these three items are repeated until all the formats are included. The file ends with a four-byte format type of 0.

    Known limitation: Retrieving ClipboardAll while cells from Microsoft Excel are on the clipboard may cause Excel to display a "no printers" dialog.

    Clipboard utilities written in AutoHotkey:

    • Deluxe Clipboard: Provides unlimited number of private, named clipboards to Copy, Cut, Paste, Append or CutAppend of selected text. www.autohotkey.com/forum/topic2665.html
    • ClipStep: Control multiple clipboards using only the keyboard's Ctrl-X-C-V. www.autohotkey.com/forum/topic4836.html
    OnClipboardChange

    Scripts can detect changes to the content of the Clipboard by using OnClipboardChange .