OnEvent Handlers

OnEvent Handlers

1
NewbieNewbie
1

    May 23, 2008#1

    I write Perl and Shell scripts that run on UNIX/Linux. It would be great if when I opened a file, I could determine the language from the shebang line (for example: #/usr/bin/perl) and select the appropriate highlighting type. I can't find any documentation on file open event handling. Am I missing something?

    Paul

    344
    MasterMaster
    344

      May 24, 2008#2

      It is not possible to do this via a macro.
      The only chance is to do it by hand or define correct file extensions per language.
      ONE language can be default syntax coloring (by a * in the definition).
      So if all your Perl scripts end with .pl you could set the star to shell language in the wordfile.

      rds Bego

      236
      MasterMaster
      236

        May 26, 2008#3

        Could be a good feature request - EditPadPro already has exactly this functionality.

        16
        Basic UserBasic User
        16

          May 27, 2008#4

          I assume scripts can be triggered on file open in the same way macros can. Why not ask for the ability to change the syntax highlighting language from a script if that's not possible already.

          The best way to implement it would probably be a function that takes a file extension as an argument, so it doesn't matter what number the language is given, and is future proof for if they implement unlimited languages or separate files for each language.

          Something like this:

          UltraEdit.activeDocument.language(".cpp")
          UltraEdit.activeDocument.language(".sh")
          UltraEdit.activeDocument.language(".bash")

          I've submitted a request via the form on the Contact Page. Anyone else who wants this should do the same, or send IDM an email as they count each request for a feature so they can measure demand and prioritise development.

          262
          MasterMaster
          262

            May 27, 2008#5

            SamHasler wrote:I assume scripts can be triggered on file open in the same way macros can.
            Well, scripts can be invoked from a command line when opening a file in the same way as macros.

            But scripts has no "execute on load" and "execute on save" as macros have when files are opened/saved from inside UE, but "onLoad" and "onUnload" has been suggested before in another thread...

            16
            Basic UserBasic User
            16

              May 29, 2008#6

              Ok, I've requested that on the Contact Page, is anyone else bothering to do that? because IDM won't prioritise it if not enough people ask for it.