AutoIt setup for EditPlus (in progress)

some AutoIt code, in EditPlus. On the left, the custom cliptext displays some handy functions just a click away, and in the main pane, beautifully syntax highlighted AutoIt code. The XP theme, as ever, is my very basic 2K style gentle greens, soothing, yet functional, all shallow reliefs and warm tones. The text highlighting follows a gently similar theme, with light browns and oranges, set agains the faintest olive-white background.
EditPlus is my favourite text editor for Windows; I basically use it for everything. And AutoIt is my favourite Windows development language. So getting the two to work together flawlessly is very important to me. It's also fairly easy.

This page explains how to setup EditPlus for AutoIt coding, with some example configurations, and hopefully shows why EditPlus makes such a choice AutoIt IDE. I'll also go on to demonstrate some neat ways you can link them together and maximize the combination; compile and run AutoIt applications from within EditPlus, compare files, receive debug output in EditPlus' built-in console, and more..

Sure, SciTe (the recommended AutoIt IDE) is functionally very good (at what it does), but I bet at least 99% of the tasks that SciTe users do every day could be done in EditPlus, or indeed any decent text editor, if you knew how to set it up. If you want to use EditPlus to code AutoIt, this page will show you how to set it up.

Note, many of these tips and tricks will apply to other quality text editors, but EditPlus is where I live and breath; work; so I'll stay focused on what I know best. If you can't get your chosen editor to play ball, perhaps somewhere out there is a developer passionate enough about his text editor to do a page just like this for your chosen combo; go Google for him!

If you haven't yet decided on a text editor, and are reading this page to help you decide, I'll cut to the chase: for my money (and it's not free) EditPlus is the best text editor for Windows, syat (and I've tried literally hundreds of them, and keep testing the best regularly), but it does lack the following features..

That's it. Apart from that, EditPus has just about every imaginable facility a coder/writer/poet/programmer/web-coder/thinker could ever want - and now with code-folding! Thank you Sangil! Now, when do I start getting commission? Just kidding; using the application every day is payment enough; the gui is uncluttered and effective, Unicode handling; excellent, configurability; Oh Boy! Let's start with the important stuff..

Are you Color Blind?

First off, you need to sort out your syntax highlighting. Don't even think about coding without syntax highlighting! Every decent text editor can do this, even command-line editors like mc. This is some code; before syntax highlighting..

code with no syntax highlighting

and after..

code with syntax highlighting

Clearly this is something you want, and Notepad isn't going to cut it. Start by downloading my AutoIt syntax file (and if you are so inclined, my ACP (Auto-Completion) file - I don't use it). Dump that inside your EditPlus program folder (I know, messy, but there you have it (in EditPlus 3, you can now specify a folder)) and find your way into EditPlus' preferences.

Navigate to Files > > Settings & Syntax, and get it looking roughly like this..

EditPlus prefs dialog ~ Files ~ settings & syntax

That is; add a new file type, and enter those details. Note the path to the syntax file you just downloaded, simply browse and locate it (next to EditPlus). Although I do have an "autocompletion" file, I find that functionality annoying, though I can see how it could be a great time-saver for some folk. For the "Func Pattern", you can simply use "func", though mine is currently, "^[ \t]*func ".

So now you have syntax highlighting, and you can see what's-what in your code This will give you massive gains in productivity. Next we need to link EditPlus and AutoIt together in meaningful ways, and we'll start by creating some "User Tools"..
an image of the editplus user tools menu, the web tools group is currently selected (cuz I'm writing a web page!)

Get tooled up..

EditPlus has loads of features, and very few that I don't use, which says a lot about its design. One of its greatest features is user-configurable tools, aka. "User Tool Groups". This enables the user, you, to put all sorts of goodies into EditPlus' tools menu.

As the name implies, you can also "group" these tools. Currently I'm using the "web tools" group, which I created for doing web development work..

F9, F12 and ALT+A are the three HotKey combos I use most often, in ALL the groups; they are configured to do the same thing in each group; F9 always provides help for the currently selected word, for example. But I'm getting ahead of myself; first we'll need to create these tools..

There are four different kinds of user tool in EditPlus; program, help (.hpl), help (.chm), and keystroke recording. The two I'll describe in detail are program, and chm help.

The "program" tool enables you to run an external program with a specific set of parameters, and (optionally) have output piped back into EditPlus' built-in console output window. The most obvious use is for running scripts, and checking debug output, live.

an image of the editplus user tools menu, the AutoIt tools group is selected, showing a variety of handy plug-in tools. As you can see, I've plugged quite a few tools into my "AutoIt Beta" menu.

The chm help tool enables you to link to a real .chm help file somewhere on your system, and with the correct paramteters, a simple hotkey will pop up the correct help page for whatever word you have selected in your script. You don't have to select the whole word, either, just put your cursor in it somewhere.

You can have any number of tools in each group (as far as I know - I've not hit a limit, yet, though you can't create more than Twenty tool keyboard shortcuts, so perhaps it's Twenty), and up to ten separate groups of tools, so there's scope for setting up a one-tool-does-all environment capable of handling most any project, including AutoIt coding.

But before you begin creating program and help tools, you'll need to create a tool group to put them in, named perhaps "AutoIt Tools" (you can call it whatever you like).

You can either get to the user tools configuration via the regular preferences, or directly from Tools >> Configure User Tools (you can make a keyboard shortcut for that, too). Once there, select an empty group and rename it by clicking the "Group Name..." button. Now you are ready to create some tools.

an image of the editplu user tools preferences, creating a new tool group, and inserting a RUN tool. The parameters are: Menu text:Run; Command:C:\path\to\autoit.exe; Argument:/ErrorStdOut "$(FilePath)";Initial Directory:"$(FileDir)"

The Run tool..

The "Run" tool is the one you will use most of all (after the help!). This tool saves your script, and sends it to the AutoIt executable to run. If your script contains any "ConsoleWrite" commands (handy for debug lines), that output will be piped right back into EditPlus console output window, which pops-up when you activate the tool.

To setup: Click the "Add Tool >>" button and select "program", enter the details so that it looks something like the image to the right, inserting your own path to wherever you keep AutoIt, of course (you can click the "..." button to browse for AutoIt3.exe (or whatever your preferred binary is called).

You can click the buttons to the right of the inputs to get special variables into the mix, the ones we'll use are "$(FilePath)", which automatically transforms at run-time, into the full path to your current document; and "$(FileDir)", which you can guess. Here's a script to test your new tool..

; example script

for $i = 1 to 10
    ConsoleWrite($i)
next
an image of the editplus console output after running the example script
Run that (either by selecting the menu item or, better; using a HotKey) and the console output will pop up and you should see something like this..
an image of the editplus user tools preferences, creating a new tool group, and inserting a chm Help tool. The parameters are: Menu text:Run; Command:C:\path\to\autoit.exe; Argument:/ErrorStdOut "$(FilePath)";Initial Directory:"$(FileDir)"

The .chm Help tool..

I really like .chm help files, which are "Compressed Help Manuals". Basically, you take a heap of regular .html files, even a whole web site, and compile them all-together into an indexed, compressed document. Quite nifty; and because of the indexing, EditPlus is able to link right in to the exact page required, no more searching the help file! (well, almost).

You can make your own .chm help manuals without too much trouble; there's a Windows SDK available, and plenty tools out there to make the process almost easy. Fortunately, AutoIt already comes with a quite excellent .chm help file that you can just use.

To setup: Click the "Add Tool >>" button and select "HTML Help File (*.chm)", enter your own path to wherever you keep AutoIt help file, and you're done.

If you click the mouse somewhere inside the word "ConsoleWrite", in our example script (above), then hit the HotKey combo you setup for help (I like F9), the AutoIt help file will launch, and the ConsoleWrite function reference page will be right there in front of you. Very Handy!

I usually leave the help file running, and just ALT-Tab back to EditPlus. If it's still running, subsequent help queries will simply bring it to the front.

EditPlus tricks for coders..


an image of the editplus functions list window - corz clock.au3 is loaded, so there's a LOT of functions, and the image is cropped below the essential features; to the right of the list can be seen the list controls; 'Go to', 'OK', 'Copy List', 'Cancel', and 'Help'. there is also a sort option beneath these buttons.

Function List

EditPlus has a lot more fun up its sleeve when it comes to AutoIt coding..

Remember the simple Function Pattern; "func"; that we put in our AutoIt file type? That wasn't for no reason..

Go to Search >> Function List, and will get a pop-up window with all your functions. Double-click any one of them (or select it, and choose 'Go to'), and your trusty editor will take you straight to that function (closing the function list window in the process). Neat. This is something else you will probably want a keyboard shortcut for; that's easy to in EditPlus.

EditPlus' cliptext main context menu, with the 'Save' option selected.

Cliptext

Think of this as a snippets library for your code. There are loads of these available for downoad at the EditPlus site, and you can easily make your own (same goes for syntax files and most other EditPlus custom files).

While downloaded cliptext libraries are good, the best ones are the ones you make yourself, and this is drag-and-drop easy. Simply select some code, and drag it into the cliptext library. A window will pop up asking you to give the item a name, and you're done.

EditPlus' 'hidden' project menu in the far bottom-left of the EditPlus window.

Projects

This is something I've just started using, though it's been available for a while. Briefly, EditPlus enables you to group files into "Projects" and do meaningful things with the entire group, like load them all into the editor together. You can switch between projects from the main Projects menu, or the 'almost hidden' menu in the far-left of the tabbed window list. My tabs are at the bottom, though the default is top, I think.

The projects facility is proving to be handy. You can even set the window order in the project prefs; something I find very useful, expecting a particular windows to be 'right there'. Every little helps.

More Handy Stuff..

Bracket Matching (Search >>Match Brace)..
Click on a bracket, and its matching bracket also gets highlighted. This happens all the time, and you just get used to using it. More than that, you can also click in any old place and EditPlus will seek the nearest brace for you. This is amazingly handy. I have it set to F5. And for F6 I have..
Bracket Matching 2 (Search >>Select Brace)..
I most often use this for navigation. click somewhere, hit F6 (my shortcut for this) and then use the arrow keys to get to either end of the bracketed code.
Word Select
I came across this about a year ago and use it thousands of times a day. Simply hold down the Ctrl key when you click a word, and the whole word gets selected. I'l do anything to avoid double-clicking, and this is a real boost.

Note: Whatever is set as your delimeter in your sytntax file, will define the boundries of what is selected when you hold the Ctrl key. You can use this to your advantage. For example, in my syntax file for .md5 files, I have only "*" as a delimeter, and I can basically select the entire filename with one click. Note that space is always a delimeter.
Comprehensive Format commands
I could do a whole page about these. Like most text editors, you can select some text, and then hit Tab to indent it, and Shift-Tab to unindent it. On top of this, EditPlus also enables you to easily, trim, join, split, align, and you name it! The one I use most often is "Reformat", which needs you to have the word-wrap setup correctly (hint: even if you don't actually USE word-wrap); but once it is, Wow! …

If you ever write plain text, trying to keep things within a certain line width, I'm sure you'll appreciate the problem that arises then you want to insert something; you need to chop off the end of that line to make it fit, and add that text to the next line, which is now too long, and needs chopped, which is added to the next line, and so on, and so on, all the way to the end of the paragraph. I used to do this manually! Now it's ALT-Q, and I use it a lot.

I don't use word-wrap for AutoIt code, but whatever you set as your word-wrap value is used for the Reformatting. This means you can have nice wide pages of code (my editor wraps around 150 characters) and keep the notes parts nice, tight, 80 character block. The Reformat command can be used to tame all sorts of paragraphs. Very handy.
Quick Searching
This is another one of these things that I've so taken for granted, that it's only when I unthinkingly try it in another application - AND IT DOESN'T WORK! that I remember that it's an EditPlus-Only feature…

You search for words. If you are anything like me, you do this a zillion times a day. Old-School methods go along the lines of.. double-click the word, Hit F3, hit enter. Well, we already know that Ctrl-clicking a word will select the whole word (as defined by our delimeter boundries), so that would save one click. But it's even easier that that..

"Find Next Word". I recommend you set it to ALT-F3, and from now on, you just click anywhere inside a word, and do ALT-F3, and Editplus jumps to the next instance of that word, selects it. ALT-F2 is plugged into "Find Previous Word", and between them, I save lots and lots of time finding stuff.
Unlimited Undo
There may actually be a limit, but I've not seen it. What I HAVE seen is me holding down Ctrl-Z for so long that I rewind a script back through two weeks of evolution (kinda zippy to watch), copy some long-lost code, and then Ctrl-Y (or whatever) to Redo all the way back to the current version. So it must be thousands and thousands of levels of undo! Probably limited only by available memory, or something like that.
Macros
It's probably because I have a macro engine running full-time on my Windows dekstop, that I haven't explored EditPlus' macro features a great deal. A macro is basically a keystroke recording that you can play back at any time, usually with a keyboard shortcut. EditPlus also allows playback of multiple macros together.

But although I use Macro Express for all my macros, I do have one permanently plugged into EditPlus, and that is "Toggle Undo", simply me doing "Ctrl-Z Ctrl-Y", which sounds devastatingly simple, but does one very useful thing.. moves your cursor to the last thing you did. You can either see the immense usefuless of this, or you can't.

(more to come...)

Welcome to the comments facility!


previous comments (two pages)   show all comments

corz - 12.06.08 3:05 am

Thanks Devin.

I will take it further, in time. Everything in time!

It still says "in-progress" at the top, and there is more I plan to add later - that's not uncommon here at the .org. If I waited until things were "finished", nothing would ever get uploaded! I also hide poems among the files, amongst other things! smiley for :ken:

The lack of custom HotKey information is pure avoidance on my part - I'd secretly hoped v3 would change everything about it - nope. The keyboard shortcut preference section is probably EditPlus' worst feature, and in need of a ground-up re-think imho, which is probably why I didn't tackle explaining it in the article yet. It is workable, though, once you get used to it, so I'll set the record straight right now, and sketch some potential copy for the page as I reply..

The HotKeys (aka. 'Keyboard Shortcuts') themselves are fairly easy to setup; it's the Keyboard menu directly under the User Tools in the preferences (Tools section). Scroll through the Types: until you get to Tool; click it; then in Commands: list, scroll (way) down until you get to User Tool 1. This is the first Tool in the menu of ALL TOOL GROUPS.

That's a gotcha, but also a useful feature, once you realize what's going on. Whatever HotKey you set for Tool 1, will be the HotKey for Tool 1 in ALL your groups. It makes sense, then, to always use the first few tools for the most-used commands, and to keep the order of those commands uniform across tool groups. For example, Tool 1 = Help manual, Tool 2 = Run, Tool 3 = Compile, and so on. And these tools would always perform the same actions, regardless of whether you were doing AutoIt code, or C++, or php, or Java, or whatever. I've gotten used to F12 to run, Alt+A to compile, F10 for file compare, etc., etc. Time-savers for the time-savers!

The order of the Command: list is a bit messed-up (3 comes after 20, for instance), but all-in there is space for 20 HotKeys. Select the tool you want to make a HotKey for, and put the mouse in the Press New Shortcut: input and press your HotKet combo. Once you have the correct HotKey combination in there, click Assign, and it will be assigned to the Tool. You can have multiple HotKeys for each tool, if you want, though that is generally a dumb idea.

I must remember to suggest to Sangil in my next mail; if only the name of the current tool (in the current group) were to pop-up in the Description panel, life would be SOOO much easier!

And yes, you have to create the user tools from scratch. But the time spent doing it is repaid a thousand-fold, at least.

Forum? No, I resist all requests for such a thing. I prefer to put this comment thing under pages.

Blog? Yes, and lots of other stuff. Check the toolbar at the top of the pages.

Recommendations are scattered throughout the site. For anything AutoIt related, the AutoIt forum is definitely worth a visit. There's a link on this page somewhere.

Feel free to ask more questions, here or elsewhere.

l*rz..

;o)
(or


nanobyte - 08.07.08 8:10 pm

Thanks for sharing the syntax file smiley for :)


Anirban - 01.08.08 5:27 am

Hi,

thanks for the useful input.
I had a query which can any one of you help me out of that?
I want to enable auto complete in edit plus 2.12(76).I want the wat to configure,i have added the .acp file but it doesn't help.Is there anything else i need to configure?
Thanks


Revanth Kumar - 20.08.08 10:14 am

Really splendid !

I'm new to AutoIt and automating small tasks using it.
I could find nothing more interesting than your work - to integrate two platforms.

I'm writing a file-comparison utility, and I think it'll not be needed anymore.

I'll keep updated with your website hereafter.
Nice work dude.

Regards,
Revanth Kumar


maarimuthu - 22.09.08 7:44 am

good site ...


Leonard - 14.01.09 10:22 pm

Reaaly good work... Thanx for all..


Vasundhar - 21.04.09 1:22 pm

Its Wonderful .. Thanks a lot


Amro - 02.09.10 1:26 pm

Great work ... keep it up, Can you tell me where to find the autocomplete file for autoit (*.acp) ... it'd be great to have it on editplus

There's a link to it in the article (above). ;o)



Sabrina - 18.10.10 9:54 pm

How does having the text in editplus split onto another line affect the appearance in a browser, can someone explain a reasonable answer please?

HTML parsers don't consider a new-line to be an actual new line, if you want that, you need to specify it with HTML code. Otherwise it is treated as a simple space. It's in the HTML spec. ;o)



fehmi - 16.06.12 10:55 pm

thanks, you are the best. editplus rulz


Srinivas - 11.10.15 10:21 am

Hi,

This article is superb!

I didn't actually get how to get the highlight on matching braces. Could you explain a bit on how to get this configured.


First, confirm that you are human by entering the code you see..

(if you find the code difficult to decipher, click it for a new one!)


gd verification image

 

Welcome to corz.org!

I'm always messing around with the back-end.. See a bug? Wait a minute and try again. Still see a bug? Mail Me!