Version backup by file type

Version backup by file type

3

    Jul 24, 2012#1

    I really like the idea of version backup for keeping a record of my changes to a program as I progress. I have explored SCM tools such as git or svn for my needs but they are just way to heavyduty for my minimal need. I like the idea of using ultracompare to see what I've done with various version in case I want to see where I introduced some bug, etc.

    I don't know about you, but I use UE for every flat file I open. Many are not programs so I don't want to save versions of them. An ideal solution would be to use version backup but only if the file type ended in something specified. This does not seem to be an option.

    One work around I thought of was having all the configuration set in version backup, but having it set to "Don't backup." Then have a macro or script that on a hot key goes in sets it to "Backup on Save" initiates the save and then goes back to set to "Don't backup." The idea being to only initiate a version backup on a hot key press. I realize I could use some bat file to probably accomplish the same thing, but I liked the idea of having UE take care of keeping track of file naming and I'm not good at writing .bat file.

    It would be even better if I could just use the build in version backup by file extension though. Any ideas?

    115
    Power UserPower User
    115

      Jul 24, 2012#2

      Changing your UE settings while running UE is not a good idea for reasons I'll let others explain.

      If you want a new feature to be added to UE, you have to contact the staff via the link at the top of the page by clicking on the words "email us directly".

      Meanwhile - if you can write a bit of code and have ADMIN rights on your PC:

      What I would suggest is set your version backup to on in UE. In your O/S create a second backup directory separate from the first one. Outside of UE use a scheduled script (lots of choices out there for what you use) that runs once a day and moves backup files with the extensions you want to keep to the second directory. Then it will delete all remaining files from the original backup directory and lastly move the saved files back into the original backup directory (in order to keep the version numbering correct). How you write it would depend on the scripting language you chose.

      3

        Jul 24, 2012#3

        That's a good idea. I will give that a try.

        I'm not sure why the default would be every file type. One of the reasons I use UE is its ability to open multi GB log files. I really don't want those duplicating on my hard drive...

        6,606548
        Grand MasterGrand Master
        6,606548

          Jul 25, 2012#4

          I have another suggestion: using 2 INI files with different settings.

          The first INI file is the standard uedit32.ini used for general text editing. In this INI the version backup feature is not enabled nor the backup feature at all. Also other configuration settings not useful for general text editing like Reload files previously open on startup, Save bookmarks, Save folded lines, ... are disabled. The configuration is simply set for editing text files of any kind with remembering in uedit32.ini as less as possible.

          But for programming purposes a second INI file is used with different settings. This second INI file must be created manually by opening in Windows Explorer %APPDATA%\IDMComp\UltraEdit. Next a copy of uedit32.ini must be made with a different name like ueprog.ini. Also uedit32.in0 and uedit32.uek must be copied to ueprog.in0 and ueprog.uek.


          Suggestion 1: Using programming configuration via command line parameter:

          A copy of the UltraEdit shortcut on desktop, start menu or quick launch bar must be made. I suggest as shortcut name UE Programming. The properties of the shortcut must be opened to edit the command line. As you surely want to be able to use both INI at the same time and I suppose that configuration setting Allow multiple instances is not enabled so that all files are opened in same instance of UltraEdit, you need to append to command line /fni /i="%APPDATA%\IDMComp\UltraEdit\ueprog.ini"

          If you click on this shortcut, always a new instance of UltraEdit is started with using the configuration settings as stored in ueprog.ini instead of using uedit32.ini. Click on this shortcut after saving the modified properties of this shortcut.

          Now configure UltraEdit for programming. Enable version backup, enable other advanced features not needed for general text editing, select perhaps a different environment. You should change something on workspace so that you can easily see if this is UltraEdit with configuration for programming or for standard text file editing. For example the background color can be slightly different or the toolbar is configured different.

          A problem with this method is to control what happens if you double click on a file in Windows Explorer to open it in (already running instance of) UltraEdit or when using Explorer shell extension of UltraEdit.

          In the programming configuration the setting Allow multiple instances should be checked. This is important if you have only UltraEdit with configuration for programming currently running and you double click on a text file to open it in UltraEdit for general text editing. The file should be opened in UltraEdit using uedit32.ini and therefore it is important that Allow multiple instances is in the programming configuration enabled to avoid opening the file in this configuration. Source code files must be opened in UltraEdit with programming configuration either from within UltraEdit (File Open, Quick Open, Explorer or Project tab) or by drag and drop into UE window with programming configuration. In standard configuration (uedit32.ini) the setting Allow multiple instances should not be checked.

          But there might remain a problem (not tested by me). If first UltraEdit with programm configuration is started and a second UltraEdit with standard configuration is also running, files opened with a double click could be opened always in a new instance of UE with standard configuration instead of the already running second instance of UltraEdit with standard configuration.

          So this method might work only well if you in general work with Allow multiple instances also for general text editing.


          Suggestion 2: Using programming configuration via copied UltraEdit program:

          This is like the suggestion above, but with an important difference. Instead of creating a shortcut with command line parameters to start a new instance of UltraEdit and load the configuration from ueprog.ini, uedit32.exe and uedit32.chm in UltraEdit program files directory are copied to ueprog.exe and ueprog.chm in same directory. Of course this copy of the 2 files must be made every time after updating UltraEdit. That's the only disadvantage of using this method.

          Next the shortcut of UltraEdit on desktop, start menu or quick launch bar must be copied to UE Programming and in the properties of this shortcut the name of the EXE file must be changed to ueprog.exe. That's it, no additional command line parameters.

          If you start ueprog.exe via the shortcut, UltraEdit searches now for ueprog.* in %APPDATA%\IDMComp\UltraEdit and makes use of the configuration in those files.

          With this method it is also possible that Allow multiple instances is also not checked in the programming configuration as this UltraEdit instance has the name ueprog.exe in the process list of Windows. So if you double click on a file associated with uedit32.exe, uedit32.exe is started and the configuration settings are loaded from uedit32.ini. If an instance of uedit32.exe is already present in Windows process list, the name of the file to open is passed to this instance of UltraEdit and the second instance of uedit32.exe is immediately closed again.

          Further you can manually in Folder Options of Windows change existing file associations with uedit32.exe to ueprog.exe if they were made with Windows Explorer. If the file associations were made with UltraEdit at Advanced - Configuration - File Associations, the change of the file association should be done also with UltraEdit. Start UltraEdit with standard configuration (uedit32.exe), open the file associations configuration dialog and remove those file types which should be associated in next step with ueprog.exe. Close the configuration dialog with OK after removing the file associations. Now start UltraEdit with programming configuration (ueprog.exe), open the file associations configuration dialog and add the file extensions for those files which should be always opened in this configuration. UltraEdit registers them in Windows registry with ueprog.exe.

          For example for source code files with extension C, CPP, H (for C/C++) the association could be changed to ueprog.exe. Double clicking on a file with such an extension now results in starting ueprog.exe and opening the file in UE with programming configuration. If an instance of ueprog.exe is already running, ueprog.exe passes the name of the file to open to already running instance of ueprog.exe and quits itself.

          Conclusion: With creating a copy of uedit32.* files to ueprog.* files in program files and configuration files directory of UltraEdit you have more or less 2 UltraEdit with 2 different configurations and you can decide which files are opened in which configuration.

          3

            Jul 27, 2012#5

            I followed Mofi's very detailed and helpful suggestions. I went with the option of defining second executable and assigning file associations to each. Has been working flawlessly for the past 2 days.