Sunday, January 28, 2018

Metasnap - a screenshot+note+palette app written in AHK

This was a little pet project that took a couple of weeks to implement in my free time. I wrote it in the autohotkey scripting language with the goal of pushing its gui capabilities.

I needed some sort a screenshot app that remembers the area I want to take a snap of and lets me leave notes in the metadata of the actual image files. While developing it I realized that I can encode other types of data inside the image files, such as color codes - so the tool mutated into a color palette editor and basic note taker on top of a screenshot app.

Before it was called "Metasnap" - I named it snapgrab. In any case, if you have cool ideas of data that can be encoded into screenshots,please let me know:)

You can download a copy from bellow:

- Take screenshots of the entire screen or a set area. The tool remembers the area between sccreenshots
- Pick colors and store them inside the screenshots you took. Picked colors are stored as both rgb and html color codes that can be easily copied to clipboard. Ideal for web developers and artists. The color palette is stored as metadata inside the screenshot file
- Leave notes about screenshots you took - inside the screenshot files metadata
- Tiny image selector with support for bookmarks

Thursday, January 25, 2018

Godot 2.1 - 1$ gesture recognition plugin

Some time ago I encountered a little charming google doodle game that uses the player's scribbles for input:

You can play it here:

That mechanic inspired me so much that I decided to try and implement it in Godot. Luckily I didnt have to start from scratch. The basic 1$ algorithm was ported to gdscript, but its bare bones implementation was not ready for gamedev. It was only a function that can be crashed. I added some commits to it. Fixed some game crashing bugs in common corner cases and added a bunch of cool features.

After porting it into a plugin, I added the ability to teach it new gestures and record them in a json file.
Added some extra optional features:
 The developer can set limited ink - to limit the size of shapes that can be drawn Upon recognizing a shape, it also emits a signal of what shape it is and how much ink was left when it was completed If the ink left is > 0, it will create a collision shape from the drawing, that can be used to interact with other parts of the game You can limit how many collision shapes can be drawn optionally.
Optional particle effect and ability to set line thickness and color Ability to set the allowed drawing area and change the mouse cursor to a pencil then it is over it

Here is a demo video:

It can recognize the following shapes out of the box (in the json file):
  • carret
  • v
  • pigtail
  • lineH
  • lineV
  • heart
  • circle
If you like the plugin, feel free to get a copy from (maybe even leave a tip in the jar ;) ):

Github page here:

If there is enough interest in it, I will port it over to Godot 3..
Might make a little game with it when I get the time :)

Wednesday, January 24, 2018

AHK scripting

It's been a while since the last post here and a lot has happened. It might take more than a few posts, but I will try to catch up. My current job has taken a way a big chunk of the time that used to be dedicated to creative tasks, however it allowed me to advance my programming skills and do some interesting things.

I noted in a previous post about what it entails- a lot data validation and entry. The company has allowed me to automate the majority of the processes via scripting. For that I chose Autohotkey- as it's the perfect windows api for macros and its open source.The AHK scripting language looks like Basic mixed with javascript and can be a pain in the neck in the start- but it's pretty cool once you get a hang on it.
Using it, I wrote a gui macro app that does my job's process automatically. Under the custom interface, the app holds a giant collection of macro scripts, web crawlers, logging and automatic data correction functions.
I called it "Sunlotion" - the name is a joke- for it fills in for all the flaws of the scheduling software that the company has been using- we shall call that "Soul Destroyer" in this article.

When I get a job request in an email or a spreadsheet, all I need to do is highlight the text and pop up Sunlotion's custom menu - it gives me the option to parse the text. Via a combination of regular expressions and functions, Sunlotion populates it's own interface's fields with the correct information from the text I fed to it. Who requested the job, who it's for, duration, date, project code, etc, etc

The date gets checked- is it on a weekend, is the date too soon (short notice jobs) , is it this year (believe it or not people make that mistake too) and so on. It gets converted to the correct format automatically- "fri 12 jan"  becomes 12/01/2018 - so as not to trip Soul Destroyer.
The duration also gets converted to the right format automatically- "2 days" becomes "15" hours. 1.5 hours becomes 1.30 hours. Project codes get automagicaly validated via a web crawler macro - when it receives it, Sunlotion  navigates to a website in the background, checks the status of the project code and if valid- proceeds. If not- it creates a reply email about the status of the code and sends it to the requester.
Another crawler macro checks what area the job is for (so it knows whom to email later) by navigating to another website and extracting the data.It detects if its fed a site code or a site name. If its a site name, the web crawler macro will retrieve the site code.

And after all the raw data is automatically organized, cleaned up, analyzed and validated by Sunlotion, I click on a button and it fires a macro that raises the job on Soul Destroyer, writes the email, attaches the right files, the right send to emails, logs the job to a spreadsheet and moves on to the next job. Rinse and repeat.
For some types of job forms I was able to completely automate the process , so my tool would raise a sequence of hundreds of jobs on Soul Destroyer without need of any supervision.

These are just scratching the surface though- there are so many macros, crawlers and functions, that it would take too long to list all.

Of course my managers noticed that this was freeing my time and gave me other tasks to keep busy. I started raising jobs that another department had to raise in the past. I wrote little apps for my department and other departments to save the company time by automating other processes(over 10 apps so far). The company in return gave me a yearly bonus and an innovation award.

There is no raise in sight, I am not technically getting a programmer's wage either, but the experience has helped me tremendously in becoming better at writing my own apps.
Since I can't show or share Sunlotion here because it was written in company time- I made another AHK app in my personal time for fun. It's called Metasnap.
You can check it out here:

I might write a post about in later on.

I have also been working on another app- that I am writing in Gdscript via Godot. Stay tuned- it will be more interesting to present :)