Display AHK file content within Explorers Preview Pane

Post your working scripts, libraries and tools
BoBo
Posts: 2519
Joined: 13 May 2014, 17:15

Display AHK file content within Explorers Preview Pane

12 Jun 2017, 03:42

Hi,
bc I have been constantly annoyed that AHK's file content hasn't been displayed within Windows Explorers preview pane I asked my ol' pal Google for advice.
sHe showed up with this: https://kickthatcomputer.wordpress.com/ ... xtensions/
So I started AHK rocket sciencing to end up with this coding masterpiece ... that you have to use @ your own risk :twisted:
Spoiler
Perceived types, defined as PerceivedType values, are similar to file types except that they refer to broad categories of file format types rather than specific file types. For example, image, text, audio, and compressed are perceived types. File types (generally public file types) can be assigned a perceived type, and should always be assigned one whenever there is one that is appropriate. For example, the image file types .bmp, .png, .jpg, and .gif are also of perceived type image.

The default perceived types are as follows:
  • Folder
    Text
    Image
    Audio
    Video
    Compressed
    Document
    System
    Application
    Gamemedia
    Contacts
https://msdn.microsoft.com/de-de/librar ... eivedtypes
Another option, taken from [here] ...
To view HTML files as text in the preview pane use this registry patch (save with a .reg extension and double-click):

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\htmlfile\shellex\{8895B1C6-B41F-4C1C-A562-0D564250836F}]
@="{1531d583-8375-4d3f-b5fb-d23bbd169f22}"
Bonus: preview any file type without a preview handler as plain text:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shellex\{8895B1C6-B41F-4C1C-A562-0D564250836F}]
@="{1531d583-8375-4d3f-b5fb-d23bbd169f22}"
Keep on coding :thumbup:
RiseUp
Posts: 27
Joined: 01 Oct 2013, 21:27

Re: Display AHK file content within Explorers Preview Pane

06 Dec 2017, 11:12

I had never heard of preview handlers until today. After plenty of googling and bouncing around, I ended up figuring out the same thing you did regarding registering a preview handler for .ahk files. Too bad I didn't first google if someone had already figured this out! :roll:

Thank you for posting your finds, though. I never knew I wanted this, but I sure do now! :D
User avatar
davebrny
Posts: 83
Joined: 05 Dec 2016, 06:26

Re: Display AHK file content within Explorers Preview Pane

07 Dec 2017, 01:26

i have some reg files i run any time i get a new computer https://gist.github.com/davebrny/d88e0f ... c4f7c73bd2

i never thought of using the regWrite command though. that could save me a few clicks!
User avatar
Delta Pythagorean
Posts: 485
Joined: 13 Feb 2017, 13:44
GitHub: DelPyth
Location: Somewhere in the US

Re: Display AHK file content within Explorers Preview Pane

09 Dec 2017, 20:14

Awesome! :thumbup:

I think this topic should be moved to tutorials just for what the purpose is for this topic.
User avatar
megnatar
Posts: 83
Joined: 27 Oct 2014, 20:49
GitHub: Megnatar
Location: The Netherlands

Re: Display AHK file content within Explorers Preview Pane

02 Apr 2018, 03:18

Here is the reg key I'm using since ages to enable preview for .ahk file type.

Save as type:
ExplorerPreview_FileType_AHK.reg

Code: Select all

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.ahk\ShellEx]
[HKEY_CLASSES_ROOT\.ahk\ShellEx\{8895b1c6-b41f-4c1c-a562-0d564250836f}]
@="{1531d583-8375-4d3f-b5fb-d23bbd169f22}"

Return to “Scripts and Functions”

Who is online

Users browsing this forum: Bing [Bot] and 66 guests