Is there a way to write a after-paste hook for the windows clipboard? - powershell

So say I have a specific value on the Windows clipboard and after I paste it, I want another different specific value to be pasted.
Is it possible to write a hook in say...powershell...to catch the paste of a specific value, copy the new next-value to the clipboard so I can paste the next link in the chain as it were?

Related

Select just-pasted text in VS Code

Sometimes I want to paste some text into a file and then immediately operate on it. For instance, to comment-out everything I pasted.
In Emacs, pasting updates Point and Mark. Is there an equivalent in VS Code?
In the extension Select By v0.12.0 I have added a command that pastes the clipboard content and keep it selected.
The command is Paste clipboard and select (selectby.pasteClipboard)

How can I copy the entire line without selection?

I wonder if there's a keyboard shortcut to copy the entire line where the cursor is without having to select it.
NOTE: I know how to duplicate it up and down, and how to move it too, but the problem is that sometimes I want to copy the same line of code to another different method, even to another different file.
You are looking for the editor.action.clipboardCopyAction command (docs). It copies either the current selection or, when nothing is selected, the whole line to the clipboard.
By default it is bound to Ctrl + C (Cmd + C on macOS).

AutoHotkey: How can I paste text into this particular textbox?

Using AutoHotkey, I have a very tiny script to write text:
^m::
SendInput Foo
Return
This works in most places like Notepad and chrome. However, it doesn't work for a particular program I am using. The program has a simple textbox which I can type text into. The program is called TextExpander. I am making sure the cursor is located in the textbox. For some reason, I can't get auto-hotkey to type text into it.
Any help? Tips?
You can look at ControlSetText. Use WindowSpy to check the control name. If it has one, you can use that to set the text.
Alternately, make sure you're trying SendInput/SendEvent/SendPlay.
If you have a way to reliably focus the box you're trying to enter text to, you can put your variable onto Clipboard and send paste via Ctrl+V SendInput, ^v.

How to force emacs's pasting to behave like in other apps

I am new emacs user and one of the things that irritates me is that when I want to replace current selected text with the one from clipboard I need to delete it first. Every other application that I know replaces pasted text with the current selection by default.
Here's a little bit more detailed description:
Select some block of text
Paste text from clipboard
Emacs just pastes text where the cursor was and previously selected text it is still there. I want that selected text was deleted first.
As artscan wrote in a comment, you can get this functionaly for the normal yank (paste) operations by adding:
(delete-selection-mode 1)
to your configuration.
If you want yank by mouse to also delete the current selection, you can add:
(put 'mouse-yank-primary 'delete-selection 'yank)
in your configuration as well.

Emacs column mode from one file to another: Register does not contain text

I am trying to copy a column from a text file to another with emacs.
I select the text with C-x, r, r, and then try to copy the same in another text with C-x,r,l + Enter. However, at the end it says: Register does not contain text. Is it because I am trying to copy from one file to another?
My crystal ball suggests that maybe you're copying from two different Emacs sessions. Registers only work within a single Emacs session.