Scripting 101: Using UltraEdit’s integrated scripting engine

May 29, 2023
Scripting 101: Using UltraEdit’s integrated scripting engine

UltraEdit has a built-in scripting engine that allows users to execute instructions (ie. JavaScript) directly inside the editor. This allows users to enjoy the power and flexibility of the JavaScript language while using the UltraEdit or UEStudio Application Object/Document commands to interact with the editor or documents open in the editor. 

Of course, this is doable with a number of workarounds such as copying a selection, saving it as a file, opening that file as an active document, and then finally running the script you coded. But that’s one of the benefits of a seamless editor like UltraEdit—everything is accessible in one spot.

Writing scripts in UltraEdit

Using scripts will usually follow the following structure:

  • Step 1: Writing the script
    Start coding your script inside UltraEdit/UEStudio. As mentioned above, you may use the latest JavaScript features (most recently updated with UE 2023.0) and the UltraEdit/UEStudio Application Object commands and Document Object Commands.

    UE’s scripts allow a variety of variables such as user input, selected text in the editor, as well as all the regular functions available in JavaScript.

    If the task you are doing is more repetitive in nature and does not rely on complex variables, you may consider using macros instead.
  • Step 2: Add the Script
    Once you’ve saved the script you have just created, you will need to add it in the Scripting Scripts dialog. This also allows you to run the scripts again should you need to in the future.To save a script, click on the “Add” button to add the script to the list. You will need to browse to the location of the script. Try to add a description to make your library of scripts easier to use—your future self will thank you.|

    Once the script has been added, you can define a hotkey for a quick and easy execution of the script. Click Okay when you are done.

    Protip: If you have just written a script in a separate tab in UltraEdit, you can navigate to the temp folder so you no longer have to save the script as a file since—you will save it in UE’s script directory anyway.
  • Step 3: Execute the Script
    To execute the script, go to the Scripting menu and press the Run Script button. You can also choose which script to run among your saved scripts.

    If a script is executed successfully, you should see a success prompt in the output window. Take note! A script may execute successfully but with the unexpected output. Examine both your script and the corresponding output to ensure the proper outcome occurs.

Where to learn more about UE’s scripting

Power tips / Website

This page lists down some techniques with examples to help you automate your text-editing operations. There are a couple of tutorials and power tips available on the UltraEdit website. For example, there is a page that lists down most of the available scripting functions as well as a compilation of common scripting techniques that can be used to manipulate and process opened text files. There is also feature documentation on the UE Wiki.

User-to-user Forums
There is no better way to find possible use cases than to check in with your peers. If you find yourself discovering tasks that can greatly benefit from a scripted operation, there is a large chance that other users have encountered similar problems—it is likely you can find similar solutions too.

UltraEdit’s forums has a special section for sharing and requesting assistance on scripts.

Tutorial Videos
What better way to learn something new than watching a demo? Ben Schwenk, former product manager and now Chief-of-Staff at Idera, shares with us a nifty example of how you can use UltraEdit’s built-in scripting and the popular AI and natural language tools to greatly simplify the process.

You will also learn how to activate some of UltraEdit’s latest improvements such as WebView2 and the new scripting engine added in UltraEdit 2023.0.

Some other examples of where you can use scripts

The possibilities are endless with scripts. But of course, there are some use cases wherein writing a script might be excessive. Familiarizing with concepts and common use cases will help in deciding whether a script might be useful. Here are some examples of where you might use scripts.

  • Adding specific parameters to fine-tune find and replace operations
  • Searching and iterating through a whole file to find complex patterns 
  • Viable substitute for convoluted regex expressions
  • Speed up navigation operations via filters and if/then statements
  • Repeatedly analyzing textually unique but structurally similar files
  • Other scripting examples…

Limited Time: Webinar on scripting

ultraedit scripting webinar

Here’s an even better way to learn something other than watching a demo—seeing it live!

Take a guided tour through UltraEdit’s application scripting feature set from the product experts themselves. From writing your first script, to automating everyday tasks, to complex file and data reconfiguration, we will get you started with one of the most powerful but often overlooked tools in UltraEdit’s arsenal.

This webinar is intended for developers of all skill levels—whether you’re a scripting savant or a newbie learning the ropes, discover how to effectively use UltraEdit’s new scripting capabilities to increase productivity. There will also be a Q&A Session at the end of the webinar so better tune in live on Thursday, June 1, 2023 at 10 AM CST.

Sign up for the webinar now!

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Recent Posts

No Results Found

The page you requested could not be found. Try refining your search, or use the navigation above to locate the post.

Latest News

Subscribe to Our Newsletter