@Ekopalypse said in Shortcut or menu path to "Rotate to right/left":
@deleelee
UPDATED VERSION
from ctypes import wintypes, WinDLL
from Npp import notepad
class ViewRotator():
def __init__(self):
self.LOWORD_LEFT = 2000
self.LOWORD_RIGHT = 2001
self.WM_COMMAND = 0x111
self.toggle_rotating_direction = False
self.npp_hwnd = WinDLL("user32").FindWindowW(u'Notepad++', None)
self.splitter_hwnd = WinDLL("user32").FindWindowExW(self.npp_hwnd, None, u'splitterContainer', None)
self.send = WinDLL("user32").SendMessageW
self.send.argtypes = [wintypes.HWND, wintypes.UINT, wintypes.WPARAM, wintypes.LPARAM]
self.send.restype = wintypes.LPARAM # LRESULT
def rotate(self):
if not notepad.isSingleView():
if self.toggle_rotating_direction:
self.send(self.splitter_hwnd, self.WM_COMMAND, self.LOWORD_RIGHT, 0)
else:
self.send(self.splitter_hwnd, self.WM_COMMAND, self.LOWORD_LEFT, 0)
self.toggle_rotating_direction = not self.toggle_rotating_direction
if not hasattr(notepad, "rotateSplitView"):
notepad.rotateSplitView = ViewRotator().rotate
notepad.rotateSplitView()
Wowsers!!! That is perfect. Thank you so much.