So a couple of weeks into my CertIV of Programming, my fingers got a bit itchy to make my own programs.
Now at this stage I am not too familiar with many programming languages or IDE’s outside of what we are learning in class. And the teacher tells me we won’t be learning to compile our code into an executable file anytime soon. So I thought I would go back to a macro building tool I have dabbled it the past with… AutoHotKey.
For those unfamiliar with AutoHotKey, I will leave you with a link to their website and summarise in a nutshell that they allow you to change what happens when you press a certain key on your keyboard. This is great for if you want to do long repetitive tasks with a press of a key.
Now it’s a funny coincidence that programming also has a a bunch of repetitive things that you have to write over and over and over again. A lot of my programmer friends have mentioned that copy pasting is a big part of the vocation. So putting two and two together I decided to make an advanced version of the built in clipboard functionality of Windows. Instead of simply just having one Ctrl-C slot that you can Ctrl-V from I decided to give the user more slots to use.
Its is amazing how deciding a destination I wanted to reach (even if I had no idea how to get there) is all the motivation I needed to jump right in and face the obstacles.
- Becoming familiar with AutoHotKey Language
- Assigning functions to key presses
- Creating Input and Message Boxes in AHK
- Saving Data to file and Loading Data from a file
- Retrieving multi line data by using unique anchors
- Using InStr and SubStr to return relevant data
- Compiling code to .exe and sharing binaries on GitHub as a release
The biggest obstacle I faced was when I was trying to retrieve multi-line text from the slots I had saved into a .txt file. This was because I initially had the loading function retrieving the first line of the file to the first slot’s variable, the second line of the file to the second slot’s variable etc… So when you had data from a slot that was multi line being saved, what loaded up was just 1 line of that, with the other lines spilling over into the other slots. Using unique anchors to envelope the data from each slot was easy to do but then I had absolutely no idea how I would retrieve it. Luckily we live in the age of googling, and that is apparently a super important thing for programmers to master. And so I learnt about Searching Strings with the unique anchors I had made and then using the Substring function to copy the relevant parts I needed between the strings. And wallah! Everything worked like a charm!
Anyway enough of my ramblings!
If you choose to download the program,
I hope you enjoy it
and would love any feedback
so I can take the app to the next level.