🎨🔥 Make your edits POP 👀 with Scintilla's color highlighting! 💥
Channel: AUTOHOTKEY Gurus
Date: 2022-07-19

Here Isaias shows us how easy it is to add color highlighting using the Scintilla control with AutoHotkey.  You can get the files used here: https://the-Automator.com/ScintillaExample

Summary: Adding Scintilla controls to Autohotkey scripts can make them more visually appealing and easier to modify.

1. 00:00 💻 Adding a Scintilla control to an AutoHotkey GUI window is easy with the win exist command and the Sci object.
 1.1 Adding syntax highlighting to an edit box is easy and this example will show you tips to make updating code easier.
 1.2 Adding the Scintilla control to a hotkey program is simple, but setting up the keywords and colors for the syntax highlighter is more difficult.
 1.3 Adding a scintilla controller is different than adding a normal control, as it does not work like adding two controls one below the other.
 1.4 You can embed a Scintilla control in a GUI window by using the win exist command to get the handle, specifying the position and size, and then using the Sci object to control the Scintilla edit box.

2. 04:31 🤔 Setting up variables and objects can make code cleaner and easier to understand.
 2.1 I'm setting the lexer to the SQL lexer using keywords instead of numbers for easier understanding.
 2.2 Using global variables is not recommended, but libraries can set up variables to make code cleaner, and local variables will only show up inside a function.
 2.3 Using objects, you can have two of them with one wrapping and the other not, allowing you to refer to one or the other in your code.

3. 07:29 🔨 Set up a default style, copy it to all elements, then style each element individually to get the desired result.
 3.1 Set up a style default to copy styling for all other styles, then set up different variables for each style to create tags with specific colors.
 3.2 Set the default style first, copy it to all elements, then style each element individually to get the desired result.
 3.3 I created a lexer file containing variables with numbers for different languages.

4. 10:46 🎨 Copy and paste HTML to add color and bold formatting to emails.
 4.1 The lexer checks if it should colorize a tag and notifies cintilla to color it when finished.
 4.2 Copy and paste HTML into the document to add color and bold formatting.
 4.3 We started doing this to make it easier to edit emails.

5. 15:08 💻 Creating a lexer from scratch is difficult, but using a built-in one is easy and saves time.
 5.1 Replace double quotes with single quotes to get basic coloring, and use classes or GUI's to customize colors.
 5.2 Using AutoHotkey to color text in a GUI is taxing on the system and complicated to do live.
 5.3 Lexing is the process of efficiently and meaningfully analyzing text to determine its structure.
 5.4 Creating a lexer from scratch is difficult, but using a built-in one is easy and saves time.

6. 19:24 🤔 Maestrith's code had a bug where color was being applied to a string, causing confusion when setting the carrot color.
 6.1 Maestrith's code revealed a problem where color was being applied to a string, causing confusion when trying to set the color for a carrot.
 6.2 The style set background is 2052 and 51 is set foreground, and 32 is a style, so you have to figure out what the style is.

7. 22:13 🤔 Write code that is clear and organized to make future modifications easier for humans to understand.
 7.1 Write code for humans to understand, as it will be difficult to modify code that is not clear.
 7.2 Writing code that is readable and organized is beneficial for future modifications.
 7.3 Humans take a while to process code, but computers can understand it intuitively.
 7.4 I was surprised to find that 32 was the default style, but I had no idea what the other parts meant, so I left them as is.

8. 26:20 🤖 Spice up your Autohotkey scripts with Scintilla controllers!
 8.1 You can use Scintilla controllers to jazz up your Autohotkey scripts and make them look more modern.
 8.2 Take a look at the options available and let us know if you have any questions.

Summary for https://youtu.be/LKqF9lrulWk by www.eightify.app