TextFX insert ... questions



  • Is this the right area to ask questions about TextFX or is it supported by someone else?

    I’m running npp v7.7 with the included TextFX v0.26

    My questions are about the TextFX Insert options

    1. Insert Current Full Path inserts the first character of the path.
    2. Insert Current File Name inserts the first character of the file name.
    3. Insert Current Directory inserts the first character of the directory path.

    For 1, 2, and 3 above the insert options for the full path, file name, and directory into the clipboard work when you right click on a tab.

    1. Is there a way to control the format for the short and long time? I’m getting
      4:43 PM 5/30/2019 (short format)
      4:43 PM Thu 05/30/2019 (long format)
      but would like
      05/30/2019 16:43 (short format)
      2019-05-30 16:43 (long format)


  • @mkupper said:

    Is this the right area to ask questions about TextFX or is it supported by someone else?

    Sure, TextFX questions are OK here!

    I’m running npp v7.7 with the included TextFX v0.26

    For the record, TextFX is NOT included with Notepad++ 7.7.



  • I dug into this a bit more.

    Unfortunately, it appears that TextFX has not been updated since 2009-08-02. It reports that its home page is http://textfx.no-ip.com/textfx/ which is a non-responding server.

    Source code is available for v2.5 but not v2.6. People have been seeking v2.6’s source code without success. I did not look to see if I could figure out who built v2.6.

    I suspect issues 1, 2, 3 reported above are all related to that the code tried to interpret a Unicode path as an ANSI string. The first character of C:… is “C” which is Unicode 0043 which on Windows machines gets stored as the bytes 43 00. Code looking at that as a null terminated ANSI string will see just “43” which is the “C”.

    The date/time format is hard coded in v2.5 though I see that:

    1. There is commented out code that generates a format close to what I’m seeking.
    2. That the v2.5 code used the user default date format from Windows. While that’s configurable I have discovered that making changes to it changes the date/time format for nearly everything in Windows including the format of the %DATE% and %TIME% environment variables which breaks batch files…

    There has been at least one stalled attempt to replace TextFX. Apparently the v2.5 code can’t be compiled for x64. I did not look hard at it to see why that’s the case as most of it seems to be plain vanilla C style code though in .cpp files.



  • @mkupper said:

    TextFX has not been updated since 2009-08-02

    Yea, it is just one of those things…

    The features that you seem to be interested in are easily replicated with a scripting plugin (e.g. Pythonscript). Do you have an interest in using that? We can help get that up and running and then show you how to get the output you need from it.



  • @Alan-Kilborn said:

    The features that you seem to be interested in are easily replicated with a scripting plugin (e.g. Pythonscript). Do you have an interest in using that? We can help get that up and running and then show you how to get the output you need from it.

    Thank you Alan. That would be useful. I created a new thread at https://notepad-plus-plus.org/community/topic/17738/textfx-customizing-the-date-time-format so that others interested in the same topic can more easily find it. My original intent had been to ask about customizing the date/time format that’s generated by TextFX. While getting ready to ask that I experimented with TextFX’s other insert … options, realized they had bugs, which topic-drifted into that TextFX itself is no longer supported…



  • @mkupper

    You didn’t create a thread for the filename/pathname functions, so I’ll address that one here. Here’s a little script that does it:

    import os
    
    curr_pos = editor.getCurrentPos()
    pathname = notepad.getCurrentFilename()
    if os.path.exists(pathname):
        while (True):
            response = notepad.prompt("Choose what you'd like to insert about current file:", '',
                '1) Complete pathname\r\n'
                '2) Only the directory name\r\n'
                '3) Only the filename and any extension\r\n'
                )
            if response == None:
                break
            else:
                try:
                    response = int(response)
                except ValueError:
                    pass
                else:
                    if response == 1:
                        editor.insertText(curr_pos, pathname)
                        editor.setEmptySelection(curr_pos + len(pathname))
                        break
                    elif response == 2:
                        dirname = cfn.rsplit(os.sep, 1)[0] + os.sep
                        editor.insertText(curr_pos, dirname)
                        editor.setEmptySelection(curr_pos + len(dirname))
                        break
                    elif response == 3:
                        filename = cfn.rsplit(os.sep, 1)[1]
                        editor.insertText(curr_pos, filename)
                        editor.setEmptySelection(curr_pos + len(filename))
                        break
    

    When run, a box like this pops up:

    Imgur

    By typing 1, 2 or 3 you will overwrite the selected blue text with your choice. You then simply press OK (or, to abort, obviously, press Cancel). Then your desired data will be written into the current document.



  • But…maybe…this script is only useful as an example, because it is just as easy to use one of Notepad++'s tab-right-click options to copy the same info to the clipboard, and then paste it somewhere else…


Log in to reply