Anyway, here’s a demo script that could accomplish the goal. I call it ReplaceYyyymmddOnFileOpen.py:
# -*- coding: utf-8 -*- # references: # https://community.notepad-plus-plus.org/topic/24257 #------------------------------------------------------------------------------- from Npp import * import time #------------------------------------------------------------------------------- class RYOFO(object): def __init__(self): notepad.callback(self.fileopened_callback, [NOTIFICATION.FILEOPENED]) notepad.callback(self.bufferactivated_callback, [NOTIFICATION.BUFFERACTIVATED]) self.process_next_buf_act = False def fileopened_callback(self, args): self.process_next_buf_act = True def bufferactivated_callback(self, args): if self.process_next_buf_act: editor.replace('YYYYMMDD', time.strftime('%Y%m%d', time.localtime())) self.process_next_buf_act = False #------------------------------------------------------------------------------- try: ryofo except NameError: ryofo = RYOFO()-
0 Votes5 Posts1k Views
-
0 Votes3 Posts304 Views
-
-1 Votes6 Posts2k Views
-
0 Votes3 Posts310 Views
-
0 Votes8 Posts2k Views
-
0 Votes4 Posts522 Views
-
2 Votes9 Posts618 Views
-
2 Votes12 Posts1k Views
-
0 Votes5 Posts1k Views
-
0 Votes3 Posts292 Views
-
0 Votes8 Posts2k Views
-
0 Votes4 Posts633 Views
-
0 Votes1 Posts162 Views
-
0 Votes5 Posts1k Views
-
1 Votes2 Posts3k Views
-
0 Votes2 Posts2k Views
-
0 Votes24 Posts7k Views
-
0 Votes9 Posts4k Views
-
0 Votes3 Posts896 Views
-
0 Votes4 Posts312 Views