Processing Ajax...

Title

Message

Confirm

Confirm

Confirm

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure?

Open Notepad and paste clipboard content

Description
This script will open a new Notepad window and paste the contents of the clipboard automatically.
Language
C#.net
Minimum Version
Created By
KarolPiechoczek
Contributors
-
Date Created
Oct 1, 2021
Date Last Modified
Oct 1, 2021

Scripted Function (Macro) Code

using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Windows.Forms;

public static class DisplayFusionFunction
{
    [STAThread]
    [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
    static extern bool PostMessage(HandleRef hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
    [DllImport("user32.dll", SetLastError = true)]
    public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string className, string windowTitle);
    const uint WM_PASTE = 0x302;
	public static void Run(IntPtr windowHandle)
	{
        Clipboard.GetText();
        Process p = Process.Start("notepad.exe");
        p.WaitForInputIdle();
        IntPtr EditHandle = FindWindowEx(p.MainWindowHandle, IntPtr.Zero, "edit", null);
        PostMessage(new HandleRef(p, EditHandle), WM_PASTE, IntPtr.Zero, IntPtr.Zero);
	}
}