Close other tab in Notepad++

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
knn
Posts: 30
Joined: 30 Mar 2020, 20:35

Close other tab in Notepad++

29 May 2020, 16:40

Is it possible with AHK to close the "next" Notepad++ Document, i.e. to close a tabulator which is to the right of the tab that I am in?

So, if I press CTRL+W it closes the current tab, but CTRL-E would close not the current tab but the next tab?
vsub
Posts: 541
Joined: 29 Sep 2015, 03:39

Re: Close other tab in Notepad++

29 May 2020, 17:15

Send,{Browser_Back} ; switch to the tab on the left side of the current
Send,{Browser_Forward} ; switch to the tab on the right side of the current

So

Code: Select all

^e::
Send,{Browser_Forward}
Send,{Blind}w
Return
knn
Posts: 30
Joined: 30 Mar 2020, 20:35

Re: Close other tab in Notepad++

29 May 2020, 17:49

First of all, thank you very much!!

You use Send,{Blind}w to close the tab. If I define CTRL+W to be something else or if I want CTRL+W to close the left tab, then your code won't work anymore.

Is there another way to close a Notepad++ tab?
iPhilip
Posts: 835
Joined: 02 Oct 2013, 12:21

Re: Close other tab in Notepad++

29 May 2020, 18:18

Hi @knn,

The following would accomplish what's in your original post:

Code: Select all

#IfWinActive ahk_class Notepad++
^e::
   SendInput, ^{PgDn}
   SendInput, ^w
Return
#IfWinActive
If you define CTRL+W (or CTRL+{PGDN}) to be something else, the following should work:

Code: Select all

#IfWinActive ahk_class Notepad++
^e::
   WinMenuSelectItem, A, , View, Tab, Next Tab
   WinMenuSelectItem, A, , File, Close
Return
#IfWinActive
Cheers,

- iPhilip
Windows 10 Pro (64 bit) - AutoHotkey v2.0+ (Unicode 64-bit)
knn
Posts: 30
Joined: 30 Mar 2020, 20:35

Re: Close other tab in Notepad++

29 May 2020, 19:00

iPhilip wrote:
29 May 2020, 18:18

Code: Select all

#IfWinActive ahk_class Notepad++
^e::
   WinMenuSelectItem, A, , View, Tab, Next Tab
   WinMenuSelectItem, A, , File, Close
Return
#IfWinActive
Doesn't work. Only works when the menu bar is visible :shifty:

Is there maybe a scintilla way to close a tab?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: peter_ahk and 236 guests