Productivity Tools with AutoHotkey

Developed in September 2023

Autohotkey Scripting Tools


bannerImage
Productivity Tools with AutoHotkey
Introduction
Tools
        Live-view for Log Files
        Clear File
        Open in Programs
        Always on Top
        Show clipboard length
        Window Hiding
        Window Manipulation
        Visual Studio
        Refresh Scripts
Conclusion
Download
Similar Projects

Introduction

While working on software for medical/research medical devices at Artinis Medical Systems, I worked on creating several productivity tools for myself and the rest of the team using AutoHotkey.

It was a very fun and useful scripting language to learn, and I was able to very effectively help myself and others with the tools I made.


Tools

Recording of the logging window in action on a test application.

Recording of the logging window in action on a test application.

Live-view for Log Files

Most projects we had would write their logs to several files, rather than writing them to a console window. This was very useful for troubleshooting, but it was difficult to read the giant blocks of text and it was more difficult to debug things that require real-time inspection of program state.

So, I created an AutoHotkey script that would open a PowerShell window that shows the content of any file in real time.
It works by selecting one or more files in Explorer, pressing Windows->shift->D, and the window is opened.

Besides showing the state of the file, it also tries to assign colors to all lines. I included all variations of tags we use for errors, warnings, debug, and info messages. I also made the text that marks the start of a program session green, to make it even clearer when logging has started.

Clear File

When working with the previously mentioned log files, eventually they would start to get extremely long.
This became cumbersome since the live view reads the whole file before reaching the real-time state. However, simply removing the files meant I couldn't open it in a live view without making the program recreate it first, which wasn't ideal.
So, I made a quick script that empties all files selected in Explorer when pressing Windows->shift->E.

Showcase of the Paint.net script opening selected three images at once. This uses the command-line interface of Paint.net within the script.

Showcase of the Paint.net script opening selected three images at once. This uses the command-line interface of Paint.net within the script.

Open in Programs

I use Notepad++ and Paint.net consistently every single day.
I don't like having to right-click a file and then select "open in Notepad++" there. Nor do I like finding a file and then having to find it again in the file selector of another program.
So, I wrote an AutoHotkey script to open the file(s) selected in Explorer in either Notepad++ or Paint.net (depending on the hotkey). I use Windows->N for Notepad++ and Windows->P for Paint.net.

Always on Top

Windows should have an easily available option to pin windows to the top of the screen. Sadly they do not, so I added it instead.
This script is actually how I found out about AutoHotkey, it's the first thing you find when searching for how to pin a window in Windows.
I still use the Hotkey provided in the tutorial I found that day, which is ctrl->space.

Show clipboard length

When writing commit messages, we had a limit of 50 characters for the first line and a limit of 72 characters for all consecutive lines.
I had a "ruler" in place to visualize the 72-character limit, but I couldn't have a second one for just the first line.
So, I wrote an AutoHotkey script that would show the text on my clipboard along with how long the string is. Now I can quickly select my first line and check its length.

Window Hiding

I wanted to make hiding windows an available feature because I like making any program I want "run in the background".
So, I wrote a Hotkey that hides my current window when I press Windows->H and unhides the last hidden window (stack-based) when I press Windows->shift->H.

However, sometimes this went wrong (like when refreshing the script), so I also added a UI that shows all hidden windows with a search bar so that I could unhide any lost window in those cases. This UI is shown when pressing ctrl->shift->H.

Some windows being moved around, minimized/maximized, and closed by using the mouse anywhere on the window, using these scripts.

Some windows being moved around, minimized/maximized, and closed by using the mouse anywhere on the window, using these scripts.

Window Manipulation

I don't like using Windows title bars. It always takes me some extra time to find the right spot to click and move my mouse to it.
So, I wrote several AutoHotkey scripts for manipulating windows. I can minimize/maximize, show/hide, move, and close them by holding specific keyboard keys and pressing specific mouse buttons.

This has completely changed my experience of using a PC.

Visual Studio

Visual Studio has terrible keyboard shortcuts that are impossible to change.
So, I wrote some AutoHotkey scripts that take my keyboard shortcuts, check if Visual Studio is open, and morph them into Visual Studio's keyboard shortcuts if so.
Now, I can press Windows->escape to cancel a build, or alt->arrow to go to the previous/next place I was in code.
I even made a Hotkey that automatically runs the "clean and sort usings" shortcut when I save for when I work on C# projects.

Refresh Scripts

While writing AutoHotkey scripts, I found that it's cumbersome to keep restarting the same script whenever changes are made.
So, I wrote a small C++ project that would find every AutoHotkey file in its directory and run them. Then, I wrote an AutoHotkey script that runs the resulting executable on Windows->A, so that I could easily refresh all of my scripts at once.

Another nice use for this executable was that I could add a shortcut to it to my startup folder so that I never have to create shortcuts for new scripts again.


Conclusion

AutoHotkey is amazing. It is extremely useful to be able to apply scripting to your everyday tasks.
I would recommend anyone who has any amount of programming or scripting knowledge to check it out and have some fun with it.


Download

Check out my Hotkeys here! These only include the productivity tools I use personally.


Project tags: #Autohotkey, #Scripting, #Tools


Similar projects:

Embedding Python Scripting in the Universal Pokemon Randomizer Thumbnail

Embedding Python Scripting in the Universal Pokemon Randomizer

Keep reading

Apps and Applied Games for Revalidation Thumbnail

Apps and Applied Games for Revalidation

Keep reading

Text-to-Speech Tool with Azure Thumbnail

Text-to-Speech Tool with Azure

Keep reading

More projects...