Userscript: titled - No more Untitled.ahk files (and more)

Discuss other useful utilities, general computing tips & tricks, Internet resources, etc.
User avatar
Menixator
Posts: 69
Joined: 30 Sep 2013, 04:10

Userscript: titled - No more Untitled.ahk files (and more)

Post by Menixator » 06 Jun 2022, 05:16

Hi,

I got irritated by all the Untitled.ahk files cluttering my downloads folder and made a little userscript to fix the download names once and for all.
It works primarily on Tampermonkey and I have tested it out with Greasemonkey with no issues as well.

Features:
  • The Download Button will use a filename generated from the topic name and a suffix to avoid clashing.
  • Adds a "Download As Button" that prompts you for a file name. The script will try to add the appropriate extension if you didn't add it
  • When the content in the codeblocks are downloaded, (if it is an ahk file) the script will add a link to the post, topic, and the full title as a comment.
The suffix is used to make sure that the content in the codeblock uses the same file name regardless of where it originates(eg: quoted stuff). It also prevents two codeblocks in the same post from being saved as the same file.

There are two versions of the script:
  • Standard Version(no dependencies): uses the length of the content in the code block as a suffix
  • MD5 Version: (depends on CryptoJS)One that uses the first 5 characters of the md5sum of the content in the code block
The script is not configurable on the fly, but if you are willing to make your own version(and I recommend you do), you can customize it in various ways. Check the script's comments for more information.

Any improvements on the default formatting of the filenames or the sanitization process is welcome. Right now, the default formats are suited to my personal preference.

This script works very well in conjunction with an extension/addon that prevents duplicate files from downloading. I'm using No More Duplicates

To Install:
  • Make sure you have Greasemonkey/Tampermonkey installed
  • Head over to the gist
  • Pick the variant you want. titled.user.js or titled_md5.user.js
  • Click on the Raw Button. Tampermonkey/GreaseMonkey should intercept it and prompt an install.
Note: Anything pre v0.1.23 will have a bug where spoiler tags break the script.

Links:
Here's another unrelated userscript that makes the logo button redirect to the boards instead of the landing page:
Spoiler
Last edited by Menixator on 11 Jun 2022, 13:42, edited 9 times in total.

BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Userscript: titled - No more Untitled.ahk files (and more)

Post by BoBo » 06 Jun 2022, 06:36

Thx for sharing this! :thumbup:

Post Reply

Return to “Other Utilities & Resources”