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 Posts364 Views
-
-1 Votes6 Posts2k Views
-
0 Votes3 Posts346 Views
-
0 Votes8 Posts3k Views
-
0 Votes4 Posts575 Views
-
2 Votes9 Posts791 Views
-
2 Votes12 Posts1k Views
-
0 Votes5 Posts2k Views
-
0 Votes3 Posts338 Views
-
0 Votes8 Posts2k Views
-
0 Votes4 Posts707 Views
-
0 Votes1 Posts204 Views
-
0 Votes5 Posts1k Views
-
1 Votes2 Posts3k Views
-
0 Votes2 Posts2k Views
-
0 Votes24 Posts7k Views
-
0 Votes9 Posts5k Views
-
0 Votes3 Posts998 Views
-
0 Votes4 Posts387 Views