Save time and effort: Auto-execute your AutoHotkey classes automatically 🕑
Channel: AUTOHOTKEY Gurus
Date: 2022-07-26

Here we show an interesting way to create a Class with Auto-Execute type functionality.  Basically your entire script is an object.  We also discuss public and private methods and the benefits of ahk V2
Learn more about Objects and Classes in our Intermediate Objects course:  https://the-Automator.com/Objects

Summary: Version 2 of AutoHotkey allows objects to access public methods of an object without disruption to internal users by creating a static method to execute automatically.

1. 00:00 💻 Create an object from a class and add a line to call the test method automatically to execute an action with AutoHotkey v2.
 1.1 Double-clicking a class file can execute an action, and this video explains how to use static methods to do this in AutoHotkey v2.
 1.2 When creating an object from a class, add a line to call the test method automatically.

2. 02:19 💻 Creating a static method allows an object to execute automatically.
 2.1 Creating a static method allows an object to automatically execute when double clicked.

3. 04:02 🤔 AutoHotkey assumed an error was due to version two, which only allows static methods to the class and non-static methods to the instance.
 3.1 AutoHotkey automatically detected an error in the code and assumed it was version two, allowing the code to only work on version two.
 3.2 In version two, static methods are available to the class, while non-static methods are only available to the instance.

4. 06:36 🔒 Objects can only access non-static methods, while classes can access static methods.
 4.1 Objects can only access non-static methods, while classes can access static methods.
 4.2 When creating an object with a class, users have access to public methods, but not static methods, which limits what they can access and prevents changes to the code from affecting them.

5. 08:51 🔒 Access public methods of an object without worrying about class changes.
 5.1 You can access certain public methods of an object, but changes to the class won't break your code.

6. 10:14 🔎 External users can request data without disruption to internal users.
 6.1 External users can request data without knowing the internal structure, while internal users can change the structure without affecting external users.

7. 11:20 🧪 Created an object to automatically run unit tests to check if changes to it have broken anything.
 7.1 I'm forcing an instance of the class to access something that can only be accessed by objects.
 7.2 I created an object that automatically executes unit tests to check if changes to the object have broken anything.

8. 13:01 🚀 Version 2 of the course offers more features than Version 1.
 8.1 Version 2 of the course allows for things that Version 1 cannot do.


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