R K
R K

Reputation: 21

Autohotkey - Copy selected text, paste in Notepad++

I'm new to Autohotkey, tried to make a macro to:

  1. Copy selection

  2. Paste it in Notepad++

  3. Playback Notepad++ macro (for formatting) shortcut: Ctrl+Shift+B

  4. Copy all the edited text

  5. Paste in Firefox text field

I tried starting with the following code, but I couldn't even get AHK to copy paste my selection to Notepad++.

^!x::

Send,  ^c

ClipWait 

IfWinExist, Notepad++

    {
    WinActivate
    Send  ^v
    }

Upvotes: 2

Views: 8946

Answers (1)

vasili111
vasili111

Reputation: 6930

Here is working script:

^!x::

Send, ^c

ClipWait 

SetTitleMatchMode, 2
IfWinExist, Notepad

    {
    WinActivate
    Send, ^v
    }
    
return

I added command SetTitleMatchMode, 2 as Joe DF mentioned in comments. That command (link) with parameter 2 sets the matching behavior of IfWinExist command so that a window's title can contain WinTitle anywhere inside it to be a match. Also added return in the end.

Upvotes: 3

Related Questions