Ryan Wells, an AHK Hero member, provided a v1 script for keeping track of the programs you were in. We took his and dialed it up a notch and we also converted it to AutoHotkey v2. You can see the video below and get both scripts here: https://the-Automator.com/TrackingTime
We also demonstrate some of the principles of converting an AutoHotkey v1 script to v2.
The Hero group is amazing; learn more here: https://the-Automator.com/AHKHero
1. 00:00 👨💻 Converting a version one script to version two and monitoring changes in webpage titles with a script, while the Switch monitor program records time spent on each window and saves it to a file.
1.1 In this video, Jonas shows how to convert a version one script to version two and demonstrates how a script created by Ryan Wells monitors changes in the title of a webpage.
1.2 The Switch monitor program records the time spent on each window and saves it to a file.
2. 02:45 💻 Speaker added app time tracking and report, converted script to V2 and simplified exit command.
2.1 The speaker added an aggregate function to track the time spent on specific apps and created a simple report to display the total time spent on each app.
2.2 Convert script to V2 and remove unnecessary directives, use "exit app" instead of "return" to exit the script.
3. 05:21 👀 Remove persistence and commas, use variables and quotation marks, and switch parameter order when converting V1 to V2 scripts.
3.1 The speaker explains how to identify potential problems when converting a V1 to V2 script by switching the language and checking for red highlights.
3.2 Remove persistence command and commas in programs as they are no longer needed and can cause issues.
3.3 Use variables as function calls in commands, pass literal text in quotation marks, and switch parameter order when using message box function.
4. 08:25 💻 Using yes or no buttons in B2 eliminates the need for if message box command, while file append in V2 uses utf-8 by default.
4.1 In V2, adding a yes or no button eliminates the need for the if message box command, but be careful with using percent signs when referring to variables in file delete commands.
4.2 In V2, file append uses utf-8 by default, but Windows defaults to utf-16, so specifying utf-8 may still be necessary.
5. 11:05 💻 A speaker shares tips on improving code readability, including replacing labels with functions, making variables global, and organizing them into logical groups.
5.1 Labels should be replaced with functions as they cannot be used for the exit command.
5.2 The speaker makes some variables global and removes unnecessary ones in their function.
5.3 The speaker prefers to keep the previous title as static and separate variables into logical groups.
6. 15:30 👨💻 Use maps instead of loops in V2, no "has key" in V2, and return a sorted string that is no longer destructive in JavaScript.
6.1 The speaker discusses how to organize code and work with objects in V2, including using maps instead of loops for certain objects and the absence of "has key" in V2.
6.2 The function now returns a sorted string that is no longer destructive, and the user has the choice to save a copy instead of destroying the original.
6.3 The lecture discusses error reporting, assigning variables, and callback functions in JavaScript.
6.4 The default formatting for time in Windows may not be the same as the specified formatting.
7. 20:19 📊 Data analysts should pay attention to case sensitivity and format when working with time strings, and consider using maps and functions that return values instead of using the same variable.
7.1 Pay attention to the case sensitivity and format when working with time strings, and the first column may not be necessary when aggregating data.
7.2 The code is working fine, with some minor changes such as using maps instead of objects and functions that return values instead of using the same variable.
8. 22:52 💻 AutoHotkey V2 has some syntax changes, but everything is an expression and attention to details is important.
8.1 Look for words with percents on both sides in regular expressions to avoid potential errors.
8.2 AutoHotkey V2 has some changes in syntax and functions, but the bulk of the program remains the same, and it's important to remember that everything is an expression and to pay attention to details like quotation marks and function returns.
Информация по комментариям в разработке