OnEvent Handlers

Help with writing and running scripts

OnEvent Handlers

Postby bdprescott » Fri May 23, 2008 5:22 pm

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
bdprescott
Newbie
 
Posts: 1
Joined: Thu May 22, 2008 3:55 pm

Re: OnEvent Handlers

Postby Bego » Sat May 24, 2008 3:54 am

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
User avatar
Bego
Master
Master
 
Posts: 357
Joined: Wed Nov 24, 2004 12:00 am
Location: Germany

Re: OnEvent Handlers

Postby pietzcker » Mon May 26, 2008 2:27 am

Could be a good feature request - EditPadPro already has exactly this functionality.
User avatar
pietzcker
Master
Master
 
Posts: 241
Joined: Sun Aug 22, 2004 11:00 pm

Re: OnEvent Handlers

Postby SamHasler » Tue May 27, 2008 4:19 am

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.
User avatar
SamHasler
Basic User
Basic User
 
Posts: 16
Joined: Mon Aug 16, 2004 11:00 pm
Location: UK

Re: OnEvent Handlers

Postby jorrasdk » Tue May 27, 2008 4:57 am

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

Re: OnEvent Handlers

Postby SamHasler » Thu May 29, 2008 2:11 am

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.
User avatar
SamHasler
Basic User
Basic User
 
Posts: 16
Joined: Mon Aug 16, 2004 11:00 pm
Location: UK


Return to Scripts

cron