Is there a way to have UltraEdit re-indent a file from the command line?

Is there a way to have UltraEdit re-indent a file from the command line?

2
NewbieNewbie
2

    Feb 25, 2018#1

    I am an emacs guy and I still have not gotten comfortable using UltraEdit as my main text editor.
    It does a great job with custom indenting and I have a client who requires that I use his UltraEdit rules to indent code I write for him.
    Is there a way I can call UltraEdit from the command line and have it indent the files for me?

    6,682583
    Grand MasterGrand Master
    6,682583

      Feb 26, 2018#2

      Yes, this is possible using a macro and UltraEdit started from command line with the parameter to run this macro on each opened file and then exit.

      So first a macro must be created for example with name ReIndentFiles with macro properties Show cancel dialog for this macro and Continue if search string not found both not checked with following code:

      Code: Select all

      InsertMode
      ColumnModeOff
      Loop
      IfNameIs ""
      ExitLoop
      EndIf
      SelectAll
      ReIndentSelection
      CloseFile Save
      EndLoop
      This macro is saved into a macro file with the name ReIndentFiles.mac. This macro file should not contain any other macro.

      Then a shortcut is needed to run UltraEdit with one or more files and the macro to re-indent them all. Example command line:

      "%ProgramFiles%\IDM Computer Solutions\UltraEdit\uedit64.exe" /fni "C:\Path To File\First File.ext" "C:\Path To File\Second File.ext" /M,E="C:\Path To Macro File\ReIndentFiles.mac"

      The command line parameters are explained in help of UltraEdit on page with title Command Line Parameters.

      Please note that UltraEdit supports also wildcards or command line like "C:\Path To Files\*.c" to open all files with file extension .c in specified directory.

      In the properties of the shortcut file should be also configured to run UltraEdit with the command line above with a minimized window.
      Best regards from an UC/UE/UES for Windows user from Austria

      2
      NewbieNewbie
      2

        Feb 26, 2018#3

        Mofi, thanks for your quick response!
        I created a batch file to run the macro, but it pops up and I get a warning saying the macro file is not valid. Do I have to save the .mac file specially?
        Oh I see now... I have to create the macro and then paste the commands into that macro editor window.
        Works like a charm! Thanks again.