TLDR: The video provides tips and tricks for improving code efficiency and functionality in AutoHotkey V2, including encapsulation, using guard clauses, simplifying test values, and ensuring correct file path usage.
1. 00:00 💻 AutoHotkey V2 has ways to restrict access in classes, but it's not backwards compatible with V1 and has some differences.
1.1 The speaker had a fun New Year's Eve and someone in the chat had a question about classes.
1.2 Autohotkey does not have the concept of private functions, but there are ways to restrict access in V2 and B1.
1.3 AutoHotkey V2 is not backwards compatible and is very different from V1, but it is helpful for programmers.
1.4 The code includes a class with a method that calls an internal function, but the speaker notes that the function should not be accessible outside of the class.
1.5 Creating a variable called roll with a new class test and calling the method roll inside the class test returns 11, but calling roll directly with two digits returns 22.
1.6 Static methods can only be accessed by calling the class directly, not through an instance of the class.
2. 18:45 🔒 Define a private function inside the get number function to ensure encapsulation and limit public access.
2.1 Define a function inside the get number function to limit its public access.
2.2 Creating a private function in a class makes it inaccessible from outside the method or even from another method in the same class.
2.3 Testing different methods and classes still results in errors.
2.4 The row function can only be accessed within the get number function due to closures, which means defining a function inside another function.
2.5 Encapsulation is used to hide internal functions from the main program to ensure that changes to those functions do not break the program.
3. 25:54 💻 Using the on message function to capture the WM paint message can help detect changes in a program's tabs, while sending a poll every half a second is sufficient for user experience and 500 milliseconds is the ideal timing for toolbar updates.
3.1 The speaker asked for help on making toolbar buttons disappear based on the active screen and wondered if there was a way to have an on message function that would pull the screen when it changes.
3.2 Events in programming can be difficult to query, but capturing the WM paint message using the on message function can be a more advanced way to detect changes in a program's tabs.
3.3 Sending a poll every half a second is sufficient for user experience as it allows time for blinking and processing the screen.
3.4 500 milliseconds is the ideal timing for toolbar updates as it is efficient and gives enough time, unless the function is complex and takes more than 10 milliseconds to compute.
3.5 The speaker questioned the use of set batch lines to minus one in a loop with built-in sleep, emphasizing the importance of efficiency in frequent tasks.
4. 31:29 👨💻 Use guard clauses to improve code efficiency with timers and GUI control commands to disable controls in MATLAB.
4.1 Use a guard clause to improve code efficiency when working with timers.
4.2 Use a guard class to check if the last window processed is the same as the current window before performing actions in a set timer.
4.3 Use the "guard close" technique to efficiently check if the current window is the same as the last one and avoid unnecessary computing power.
4.4 You can use the GUI control command to disable controls in MATLAB, making them grayed out and uninteractable until enabled again.
4.5 You can program a trinary variable to enable or disable a GUI control without having to manually go through the GUI control every time it draws the bar.
4.6 The speaker discusses creating a variable outside of a string to make it easier to control GUI and suggests using a variable to determine the screen instead of a string.
5. 40:10 📝 If "screen" is present, disable the "home" variable and enable the button only if it contains "screen" or "home" using a zero or one variable.
5.1 Create a string variable with the word "home" and use a "not" operator to disable it if the word "screen" is present.
5.2 The button should be enabled if it contains the word "screen" or "home" and disabled otherwise, with "disabled" being the only option available for programming purposes.
6. 44:30 💻 Using parentheses instead of if statements can quickly determine if a variable is empty or not, making it easier to convert text into a one or a zero for further use in shell scripting
7. 55:38 📝 Simplify and present test values in a different way for better understanding, remove redundant words and access data directly using stir spl without storing it in a variable, and convert data into objects by splitting it on new lines and ampersands
8. 01:03:41 📋 When pasting a file path into an open window dialogue, make sure to use the correct type of dialog, check clipboard contents, and ensure the file path is correct