; ; AutoHotkey Version: 1.x ; Language: English ; Platform: Win9x/NT ; Author: Jack Dunning, Jack's AutoHotkey Blog (https://jacks-autohotkey-blog.com/) ; ; /* Script Function: The CopyRef.ahk script copies any selected text to an "Untitled - Notepad" window. The script uses the standard Windows Clipboard manipulation routine discussed in detail at: https://jacks-autohotkey-blog.com/2016/03/23/autohotkey-windows-clipboard-techniques-for-swapping-letters-beginning-hotkeys-part-9/ Be sure to save the Notepad file after copying references. April 21, 2020 Copy text to Notepad, WordPad or GUI Edit field To set up a reference target window tag either a NotePad, WordPad, or GUI Edit field as the target by activating the window, clicking in the target field and pressing: Ctrl+Win+Alt+T Then move to any source window, highlight the targeted text, then press: Ctrl+Alt+C Without activating the target window, the script uses the Control, EditPaste command to insert the text into the window at the cursor location. Uncomment the ControlSetText command to replace rather than add text. Use Ctrl+Win+Alt+R to return to the tagged window. */ ^!c:: If !WinTag { MsgBox, Tag a target window in NotePad ,`rWordPad or a GUI edit field:`r`r 1 . Activate window`n 2 . Press Ctrl+Win+Alt+T Return } OldClipboard := ClipboardAll Clipboard := "" ;clears the Clipboard SendInput, ^c ClipWait 0 ; pause for Clipboard data If ErrorLevel { MsgBox, No text selected! Return } Control, EditPaste, %Clipboard% `n`n ,%control%, ahk_id %WinTag% ; To replace text (rather than add), use the following ControlSetText command: ; ControlSetText , %Control%, %Clipboard%, ahk_id %WinTag% ToolTip , Text inserted into %WinTitle%`rControl: %control%! Sleep, 3000 ToolTip Clipboard := OldClipboard Return ^!#t:: Click, %A_CaretX%, %A_CaretY% MouseGetPos, , , WinTag, Control WinGetTitle, WinTitle, ahk_id %WinTag% MsgBox The "%WinTitle%" window is tagged!`rUnique ID: %WinTag%`rControl: %Control%`rCtrl+Win+Alt+R to activate. Return ^!#r:: WinActivate, ahk_id %WinTag% Return