Question regarding Callback & [NOTIFICATION.FILEOPENED]

  • Sascha Offe
    Sascha Offe

    Hi there,

    first of all, thanks for PythonScript, great plug-in!

    I've written a script that scans for ".LOG" at the beginning of a text file, and if it's found, appends a timestamp to the file. It works fine if I call the scipt manually and also if I put it directly in my custom

    But my plan was actually to use the callback feature, so that each opened file will be automatically checked -- but either I misunderstood the use of Callback or I'm missing something else.

    import datetime
    def updateLog():
    notepad.callback(updateLog, [NOTIFICATION.FILEOPENED])

    A test with "if" returns true, so the registration seems to work.
    I've also change the initialisation from LAZY to ATSTARTUP.
    But nothing happens when I open my test file, neither via double click nor File -> Open...

    - Notepad++ 6.3.2 (Unicode)
    - PythonScript 0.9.2

    Thanks in advance for your help!


    • I'm not in a place to check at the moment, but I think your callback
      function needs an argument (just one called, for example "args").
      The console may show a better error message.

  • Sascha Offe
    Sascha Offe

    You were right, the argument was missing; thanks.