Menu

Save Filenames incorrect on first save

Josh
2008-05-13
2012-11-14
  • Josh

    Josh - 2008-05-13

    With the messages:
    NPPN_FILESAVED and NPPN_FILEBEFORESAVE

    If the user makes a new file, "New 1", and then does a save, and chooses a new name for the file, NPPM_GETFILENAME will still give the old, "New 1" filename.  Is there another way to get the filename, or a different message i should look for?

     
    • Josh

      Josh - 2008-07-07

      Ok, so now Load Filenames are incorrect on both NPPN_FILEBEFOREOPEN and NPPN_FILEOPENED

      Any calls to NPPM_GETFILENAME will get the file that is currently selected, but it looks like that selection doesn't update until after the OPENED call.  It works ok for the first file opened, but any files open thereafter will not get a correct filename from NPPM_GETFILENAME.

      This is version 5.0

       
    • Björn Lundin

      Björn Lundin - 2008-05-14

      Yeah, see my monolog at
      <http://sourceforge.net/forum/forum.php?thread_id=2021691&forum_id=482781>

      Unfortuently, there seems not too much todo about it

      /Björn

       
    • Don HO

      Don HO - 2008-05-14

      I just
      1. With which version of Notepad++ your plugin works?
      2. Make sure your Notepad_plus_msgs.h is updated (with v4.9.2 : http://notepad-plus.svn.sourceforge.net/viewvc/notepad-plus/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h?revision=195&view=markup\)
      3. Showing me your code may help.

      Don

       
      • Josh

        Josh - 2008-06-11

        I downloaded the latest notepad++ exe, v4.9.2, and am using the messages from the link you mentioned, and I am still experiencing this problem in both FILESAVED && FILEBEFORESAVE when using NPPM_GETFILENAME   

        NPPM_GETFILENAME is defined as #define NPPM_GETFILENAME            (RUNCOMMAND_USER + FILE_NAME)
        RUNCOMMAND_USER = WM_USER + 3000, and FILENAME is 3

        NPPN_FIRST = 1000;
        NPPN_FILEBEFORESAVE = NPPN_FIRST + 7;
        NPPN_FILESAVED = NPPN_FIRST + 8;

        Same steps as before to repro, new file, hit save as, and when i make a GETFILENAME call, i get the name of the file before the save as.  Its arguable that FileBeforeSave and GetFileName should return the name of the file before its changed, but FileSaved really should return the true filename that was saved.

         
        • Harry

          Harry - 2008-06-12

          Could you please try again with v5.0? Most of the times it should render the correct name, unless a file that is not active is being saved (as with save all, close all etc).

          Maybe the message needs some expansion where it gives the filename as part of the notification.

           
          • Josh

            Josh - 2008-06-12

            I don't see any links to version 5 in the download section, is there somewhere else i should grab it?

             
            • Harry

              Harry - 2008-06-12

              You can find it in open discussion, v5 alpha. Currently its pretty high listed, you cant miss it :)

               
    • Josh

      Josh - 2008-06-13

      Thanks, found it, tested it, and it seems to fix my problem.