Accessing Recent Files- Part 2-Jack Dunning’s QuickLinks then using LinkView

In the first part of creating a link list of files for accessing I had a Proof of Concept that used AHK script to capture the information to a file and Excel to display and create hyperlinks.

I’d commented that there didn’t seem to be similar programs that did this sort of thing and then came across QuickLink by Jack Dunning that went down the path of creating shortcut links. See below. So I decided to explore that.

I’ve just found a bug in my program, I use emoji’s in some of my FilePaths, eg:

C:\Users\drake\Documents\0-Excel ๐Ÿ˜‘\0-MDA\

But this translates, when saving to .csv/.txt file as below so the link doesn’t work:

C:\Users\drake\Documents\0-Excel ??\0-MDA\

I’m not quite sure how I’m to deal with that, you have to have the proper encoding on the file to be able to save emoji’s to it. ( My solution was to remove the emoji’s from directories, KISS principle)

AHK upgrades to script process

I wanted to add some embellishments to the process, these included:

  1. I had a hotkey that would open the .csv file for editing, so I could update a note related to a specific file & and also delete a line of the file that related to a specific file
  2. Also be able to save Folders as well as files
  3. I added a project column so that I could filter by order/extension and project as well
  4. I added a specific script to delete a line ID, this ended up being a complex task, as I had to read the file to find a number that matched the ID and write to a separate file all the rows APART from the line that contained the matching line number ID then I had to delete the original file and then save the new file to the old file name. A long process *(there was a AHK library that I could use for file content manipulation but I’d has issues with that in the past, so chose to do it a longer and more tedious way)
  5. I may want to add a drop-down list so that I can choose the directory to start in to select files/folders. This would allow me to be in specific folders to start with so speed up file selection, eg Project folder or AHK script folder or General Docs folder. Although I do have Quick Access Popup to get me to popular directories on my PC. So not a major

To date I’ve done 1 to 4 but intend to do 5. This will require a GUI and it might be better to have a general GUI for imputing all the info such as notes & projects in one gui to speed up the process, also maybe the same gui to allow for line deletion.

I should upload the modified files to Google Drive at sometime so that others can access them. I need to complete Item 5 before I do that.

A link for research on 5 but in a browser ? https://autohotkey.com/board/topic/23265-how-do-i-create-a-browse-button-to-select-a-folder/

You can download updated files HERE

  • ^#a:: select file to store and note about file in FileListCSV
  • ^#q:: select FOLDER to store and note about file in FileListCSV
  • ^#d:: ; This DELETES a line by Number Entered  in FileListCSV
  • ^#s:: ; This opens the Report file in Notepad++

You will need to modify all the paths in the file to where you locate your files.

I sort of lost interest in this as it requires AHK & Excel.

Alternative method- Using QuickLink by Jack Dunning instead

I’m still not happy with using AHK and Excel to make this process work. I’d prefer one code platform. I came across the AHK GUI drop down list to a folder with shortcut links process that I will explore (see below) but you can’t see the note attached to the file in the list. But worth investigating anyway. Its almost Quick Access popup

AHK GUI drop down list to a folder with shortcut links

I’ve come across a different process that uses a shortcut link list that you can use to select an item. There are a couple of scripts and discussions in the following links, Forum Topic and Jack Dunning’s Article on QuickLinks and his link to download QuickLinks

When I initially tried the script from the AHK forum topic I could see the links but not create the shortcut links, so started to try and write the script to be able to create new shortcut links with partial success. I could make a link as long as there were no spaces in the file & path name.

I then downloaded Jack Dunning’s QuickLink and saw that there was a selection in the pop-up that allowed you to make your own shortcut link from the menu. So that was great.

I was still unhappy with this method as the comments needed to be added to the shortcut link & you had to drill into the file to see the comment.

I did have a thought of being able to maybe use a HOVER TOOLTIP on the shortcut as a way of finding out what the comment was in the shortcut link.

Then I had a wee update on a project file and I found I was working in 3 separate files for the same task, so I made the shortcut links and then renamed the shortcut link to the comment I wanted to make about the file- so the actual file descriptor is what shows up.

So this is maybe the tool I’m looking for.

You can quickly go to the directory, that’s kept on the main user path, and delete outdated links.

You don’t need to know what the file name or path is, and as long as you have the filetype associated with a program it will start the program to open it. So it meets all my requirements on that score

so going back to my objectives list :

  1. store a list of files that I want to refer back to later
  2. on clicking on a particular file in the list, will open up the file, and the program it relates to, if that is not active
  3. be easy to access & use, so that Id use it frequently (Iโ€™m thinking hotkey here)
  4. has a date so that it can be sorted in reverse order (latest at top)
  5. Has a notes/description field so that I can describe what is important about that particular file, eg 2nd rev and main drg for fencing thatโ€™s been issued
  6. Has a good search facility so that you can filter by file type and date. Maybe even project.
  7. Needs to be quite fast in operation.

Not quite all the things I want when I was scoping the project, in that I can’t sort them, but I can put a date at the front of the folder where I’m keeping the links

It is fast to use and also reasonably simple. There is a bit of editing required to re-name the link so that it makes sense to me when revisiting the links, although a way around that, if its too complex, is to add a .txt file to the directory so that you can put an explanatory note in there.

So at this point I’ve got something practical that I can use. I need to start using it to see if it will meet my needs

Quicklinks by AHK_User

This article shows an adaptation of part of Jack Dunning’s QuickLinks that allows for subdirectories, which the original QuickLinks doesn’t seem to have. This is more convenient as the number of files you are keeping track of grows.

The script doesn’t have the creating new link edit to it so I may need to explore further to see if I can incorporate the 2 together.

Inside the updated Jack Dunning’s Quicklinks there was supposed to be a sub-directory method but I couldn’t get that to work.

ListViews in AHK

Step 1 Stephen MillardAutoHotKey: Quick Access to Files and Folder

Whereas I’d said that I couldn’t find code in AHK of anyone who’d done this before I then came across this article AutoHotKey: Quick Access to Files and Folders that did exactly that!

It allows for clickable items in a list, on double clicking on an item it then opens up either Explorer or Text Editor. Stephen Millard has a list of files that he frequently uses, and he makes a list of them in a file that he can access. So, in his version, you add a line for each File/Folder you want to access

Step 2. Accessing the created file. Joe Glines Easily pushing delimited data into a ListView in AutoHotkey

I came across Step 2. Joe Glines Easily pushing delimited data into a ListView in AutoHotkey video:

This was great because it used the ListView to pull data from a file as one of its methods. So I could use the information I’d created and display it in a Pop-up. So that was step 2.

In Step 1 there was a method to activate a line and open a program, that was limited to either text editor or Explore, but the basics were fleshed out.

I had to re-order data inputted from the file and also had to add a header (as this set out column widths, so I just used what was in the code to extend the Proof of Concept.

A nice outcome of his ListView code is that he can sort on the columns, so can sort ascending or descending. I don’t know if you can put a filter in to only select a single file type, maybe something to explore later.

Step 3. If, Else if (ExtEnd=jpg or ExtEnd=gif or ExtEnd=tiff), else for stepping through file extension types

In other languages there is a CHOICE or MATCH for a whole lot of alternatives, that was what I was looking for when I was, after selecting a file, having to look at its extension type to then chooser the program to open it with. So if it’s a .txt it’ll opern Notepad (or Notepad++) and if a pdf then open Adobe reader, if a xlsx then open excel etc. And if a Dir (what I’m calling Folder extension) then it’ll open Explorer.

So I’ve got quite a few file extension types that I have to take care of with a few extensions all needing the same program to open them. I’m using the If, Else if (ExtEnd=jpg or ExtEnd=gif or ExtEnd=tiff), else process to do this until I can fin d a more efficient way of doing it. I’d prefer as MATCH list that would be a nicer way to write it.

Because of this the code is a bit specific, so there is no point in compiling it for others in case they haven’t got the same software and it being located on the same paths as my program activation files.

Step 4. Adding colour to alternate lines using Class_LV-Colors

Initially I found a forum topic talking about Pulovers Class_LV_Rows and was quite keen on using this to modify the information once3 it got into the table, but ended up realising that I’d only got a copy on display, so I’d need then to re-write that information back to the original file.

Since I’d already been around the houses doing that for the DELETE row number script I’d decided that I’d not use that. In the topic discussion someone pensioned they used the LV_Color class so I looked at that instead.

So I now have alternating lines showing different colours, so easier to read (in my opinion).

Step 5- Interface developed in future

I now have 2 bits of code:

one I’ve appended to my main Email/Date double tap code which is always live and allows me to add files & folders to my list, edit the text file and delete rows individually.

two, to display files and click on row to activate specific file with specific program.

I should combine them into one file and also maybe have a single interface, which is the display GUI, but add the buttons from the first code to that so that I can easily add/delete rows in the list. It would be a better way to go as this could be activated with just one hotkey so easier to remember instead of 5 at present.

Maybe learning a bit more about GUI’s and AHK-just-me who created the Class_LV-Colors has a few more classes to play with that may need exploring.

End comment

Link for code for ListView for download script files. Note file paths and program paths may be totally wrong for your PC.

QuickLinks

QuickLinks is just a paired down version of Quick Access Popup in some ways, but uses links, and I can keep it separate for storing files I want to get at later. It also does folders, so that’s handy for the coding so I can revisit projects after putting them down for a while.

I’ve got a Ctrl + Shift + LMouseButton as a hotkey, and I’ll initiate it at startup with a shortcutlink in the startup folder.

So now I’ve got to use it and then I can review it later.

The one frustration so far is the lack of sub directories to allow for nesting of different sub-folders under folders that the AHK_User seems to have solved. It allows for multidepth nesting so that is good.

If I’d got the sub-directories working I may have stayed with Quicklinks but in the end there was not the descriptor for the file, or rather you could name the file with the descriptor.

So it was a different path to the one I was initially going down, built by others, so not bespoke to my requirements

ListViews

This seemed a better path in that is met my original objectives (apart from filtering columns at present) but it only requires one program, AutoHotKeys rather than using Excel as well.

One thing that is a peeve in Excel is it takes a while to start (it is an amazing program though) and also you have blank sheet that you have to close down as well. Also programing in 2 different codes AHK and VBA, and having to maintain both.

So now having to only use AUTOHOTKEY it speeds up the program so much and is a lot quicker to use.

I can see myself adding more loops for starting other programs to meet all the file extension types I haven’t considered at present, but I’m pleased with the program to date, this is what I initially thought the program should be.

I’ve got to use the program on a couple of live projects to see how I want to enhance it.

A good learning path, specifically ListViews , and coming to terms with functions and Classes.

I’m not sure if I can develop it into a compiled code that others can use, an ini file to associate a program with a file extension type, so that can be chosen by others to suit their own setup.

Using ini file for lookup

Instead of if/else if/else I’m looking to use key value pairs in an ini file to lookup key- which is program extension and have a value, the program associated with that key, so that in the main program all I have to do, after selecting file I want to open , is for it t take the extension type and look up the program it needs to execute that file.

So far I’ve been able to do this with PDF and TXT files and am working through other scenarios

The reasoning behind doing it this way is that the program can be more generic so that anyone can create key Value pairs in a txt file so that the main file can be compiled into an executable. This will allow non-programners to be able to use it. This is still a work in progress.