Automatic Wordfile (syntax highlighting) association

Syntax highlighting, code folding, brace matching, code indenting, and function list

Automatic Wordfile (syntax highlighting) association

Postby ecarmody » Fri Oct 19, 2007 3:05 pm

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
User avatar
ecarmody
Newbie
 
Posts: 2
Joined: Mon Jul 10, 2006 11:00 pm

Re: Automatic Wordfile (syntax highlighting) association

Postby jorrasdk » Sat Oct 20, 2007 9:08 am

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.
User avatar
jorrasdk
Master
Master
 
Posts: 275
Joined: Mon Mar 19, 2007 11:00 pm
Location: Denmark

Re: Automatic Wordfile (syntax highlighting) association

Postby Mofi » Sun Oct 21, 2007 8:47 am

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.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4062
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to Syntax Highlighting

cron