AHKCon 2: Which Programming approach to take & why to take them / how to evaluate each one
Channel: AUTOHOTKEY Gurus
Date: 2022-08-07

In the second hour of AHKCon we discuss pros & cons of different Automation Approaches to take.   If you'd like to learn more In this video I cover 17 different approaches https://the-Automator.com/WaysToAutomate
Learn more about AHKCon here:  https://the-Automator.com/AHKCon

TLDR: Automation can be made easier and more efficient by using the Send command, COM objects, UIA libraries, SQL queries, XPath libraries, Windows' Steps Recorder, and JWT tokens.

1. 00:00 🤔 People are discussing the best programming approaches to use when writing scripts, considering user, machine, and API/keystrokes/mouse clicks factors.
 1.1 A script was created to work with Google Translate.
 1.2 People are discussing the best programming approaches to use when writing scripts, taking into account factors such as using mouse clicks and keystrokes or an API approach.
 1.3 It is important to consider who will be using the code, how many machines it will be run on, and if an API or keystrokes/mouse clicks should be used.

2. 03:41 💡 Educate customers on automation implications and use block input or clipboard to avoid user interaction issues.
 2.1 Avoiding clicks, mouse, and keyboard use is preferred to prevent humans from using the computer simultaneously.
 2.2 Avoid using mouse and keystrokes for automation as it often doesn't work and people may not understand the implications.
 2.3 An education process is needed to help customers understand what they are asking for and to help them re-mold their idea.
 2.4 Be careful when sending keystrokes as it can be unreliable and inconsistent.
 2.5 Having multiple tabs open in multiple windows can cause scripts to fail.
 2.6 Send keystrokes or mouse movements with caution, using block input or clipboard to avoid user interaction issues.

3. 11:58 🤖 Automate quick tasks with the Send command and reliable tasks with COM objects for efficient coding.
 3.1 Matthew created a hot string on LinkedIn to automatically respond to salesy messages with a polite message.
 3.2 If you need something done quickly, automation tools can be useful, but consider how often you'll use it and if it's a one-time task.
 3.3 For quick and reliable tasks, use the Send command for quick tasks and COM objects for reliable tasks.
 3.4 Using COM objects can be reliable and fast for coding, but if you don't know the options available, it may take longer.

4. 15:48 🤖 Automate tasks more efficiently with the UIA library and Alchemist Inspector Tool to generate an AutoHotkey class with links to documentation for each function.
 4.1 Using the UIA library is more reliable than SendInput, and there is a Comm Inspector GUI tool that can help you quickly find methods for a COM object.
 4.2 Joe and I discuss automation and the need to read the manual for a com object when choosing which type of automation to use.
 4.3 This tool generates an AutoHotkey class with links to documentation for each function.
 4.4 Download Alchemist Inspector Tool and Win 32 Classic Comp Class from the page to make a video walking through how to use it.

5. 21:43 💡 Reflection, COM objects, UIA libraries, and SQL queries can all be used to automate processes, but each has its own advantages and disadvantages.
 5.1 Reflection can be used to detect the interface of a COM object or .NET assembly as an alternative to using COM objects or UIA libraries.
 5.2 When automating, consider who will maintain the code and if they are familiar with the tools used.
 5.3 We found that connecting to the local database was a better solution than making HTTP requests for our tool.
 5.4 Using SQL queries instead of an API, we can quickly and reliably get data from a WordPress website's MySQL database.
 5.5 UIA bridges the gap between API and COM, allowing for programmatic interaction with controls in older programs.
 5.6 UIA is an interface for accessibility functionality, but it has some limitations and can be difficult to use in certain situations.

6. 28:21 💻 Automating GUI creation from XML structures can be done using AutoHotkey and XPath libraries.
 6.1 Different automation approaches can be chosen depending on the task, with restrictions on downloading executable files being a factor.
 6.2 Alternative methods of connecting to a database behind a citrix system may be possible.


7. 34:35 💻 Generate a class with documentation and links to help users understand the code and interface to quickly automate tasks using the Component Object Model (COM).
 7.1 Using the correct data structure can make automating scripts easier and allow for easier access to data.
 7.2 This script generates a class with documentation and links to help users understand the code and interface.
 7.3 This tool is a great starting point for automating tasks and quickly generates a class with 

8. 45:15 🤔 Automating programs can be made easier by using Windows' Steps Recorder and JWT tokens for secure web service APIs.