Recently I have learned from Joe Glines aka the-Automator this nice way to quickly create a Gist with AutoHotkey. I share here my improved solution/ workflow.
Prerequisites
GitHub token
To create a Git by API/ script you need to get a GitHub Token.
See documentation here: https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token
Be aware: after creation, you can not view the token at a later time. Therefore I recommend you to store it for example in your Password Manager as Secured note. (I personally use LastPass)
(If you forget it, you will need to create a new token.)
Jxon AHK Library
The provided AHK script makes use of the Jxon Library available here: https://github.com/cocobelgica/AutoHotkey-JSON
This library is also available in my AHK GitHub.
AHK Script
Improvements
From Joe's script, I have made the following changes:
- GUI improvements
- Add Cancel
- Multiple lines for the Description
- Wider GUI width
- Clean-up Dependencies: only requires Jxon Library (replace ParseJSON by Jxon_Load)
- No need for GitName to be filled
- Open Url after Gist creation (especially useful for commenting the Gist e.g. linking to related blog post)
- Works not only for AHK but any type of files / Clean-up file extension handling
- Git Token is stored as a setting in the Registry
Get the script
The script is available on my GitHub here.
Dependencies
You could compile it as a standalone version if you have AHK installed. (If you want a compiled standalone version, you can reach out to me in the comments or via Twitter)
You can also download a more standalone version from the Gist below.
Code
You can view the code in this Gist.
This is a slightly different version than from my GitHub repo version - mainly because of authentification issue with VPN and proxy.
I have also moved the PowerTools Lib dependencies for setting the registry setting inside the Gist so that it only requires the Jxon Lib.
I really like the way the script send the Http Request and parse the response using the Jxon functions. (Great and key learning in Joe's sharing)
Run the script
I prefer to run the script by running it ;-) instead of having it waiting for a hotkey trigger.
You can run it by double-clicking on it (if AHK.exe is set as default app to open.)
I like to run it from my preferred Application Launcher Executor.
I have simply added a shortcut to this file and moved it to my indexed Apps Favorites location.
No comments:
Post a Comment