Automatic Wordfile (syntax highlighting) association

Automatic Wordfile (syntax highlighting) association

2
NewbieNewbie
2

    Oct 19, 2007#1

    Hi,

    I have an extensive wordfile that I've built up over the years and don't have any problems with it specifically. My question is how to automatically select a syntax from the file when I open a specific file type.

    The problem is that this particular souce code file type that I am dealing with is exported from the native developement environment as a .txt file.

    Obviously I do not want to assoicate .txt to the syntax group in the wordfile. Every time I open these source files I need to go to the VIEWAS menu and select the specific file type.

    Is there a way to have UltraEdit know to select the wordfile type based on the folder I open them from?

    Or any other idea's on how to automatically select the wordfile type?

    Appreciate any comments or suggestions.
    Cheers,
    Eric

    262
    MasterMaster
    262

      Oct 20, 2007#2

      There are no macro or script commands for changing syntax highlighting, so if you do not have a situation with an extension (txt) defined in the wordfile there is only the manual approach you yourself describe.

      How about changing the export procedure from your development environment, so exports are renamed from foo.txt to foo.mytxt. Defining your own extension, so you can associate this to a syntax highlighting scheme.

      If your export cannot export to other than txt, then place a BAT-file in you folder that performs a REN *.txt *.mytxt and run this after every export.


      After release of version 13.20 I'm collecting new enhancement suggestions for IDM. One of my thoughts is to ask for a property and a method for the scripting environment to control syntax highlighting. To be used when creating files not saved yet (or in your case for "generic" multipurpose extensions like txt).

      Example :

      if(UltraEdit.activeDocument.highlightingType != "HTML") {
      UltraEdit.activeDocument.highlighting("HTML");
      }


      But maybe I should ask for an enhancement to the macro environment as well. This way you could write something like:

      IfExtIs "txt"
      Find RegExp "*my special pattern*"
      IfFound
      Highligting "MySpecialSyntax"
      EndIf
      EndIf


      and use it for an macro for file load. What do you think.

      6,675585
      Grand MasterGrand Master
      6,675585

        Oct 21, 2007#3

        Could you use File Name = instead of File Extension = ?

        If there are not too many files that could be a solution. Please note: File Name = requires the file names only without path, and wildcards are not possible. Example:

        File Name = foo.txt source.txt


        jorrasdk: Very good idea. I would support your feature request for both. Especially for "container" file types like TXT HTML XML such a method to select the syntax highlighting based on a keyword found in the file on file load would be a great help.
        Best regards from an UC/UE/UES for Windows user from Austria