FileSave&Launch- renaming Recent Files- Part 3

After setting up listview as the method to display the files as per previous post Accessing Recent Files- Part 2-Jack Dunning’s QuickLinks then using LinkView which sorted out the principle of the program there were a few things I wanted to do to make it work in a more generic way.

  1. Use an ini file for extension lookup, so people could add the file types and programs that ran these in a separate place
  2. be able to alter text size of the list (I was finding default text size too small, also column width as it shows on screen & set alternative colours for users preference
  3. Have buttons for other actions instead of hotkeys, so you only need to remember the main hotkey to run the program
  4. Will think about adding paths to Ini file for specific files such as ini and text list file, but some are used inside function so are local variables , not global. (Solved- to use a global variable inside a fuction you put global in front of the variable and so it goes and gets it.
  5. A help file or link to URL to describe app may be a good exercise.

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.

Also you don’t know how many different extwensions you’d need, so if you’d always have to add another Else IF before the final Else in the original code. Also deleting an extension is far easier in an ini file

I’ve wondered about automating adding extensions to an ini file but its only a bit of text editing so I won’t automate that.

Possibly I should put some of the paths to files in the ini file, I’ll think about that.

I have put comments in ini file to help explain what is going on in it. I haven’t done this before but its handy.

[Counter]
;Current count of First Column row number, increments by 1 each time new file/folder row created- used to delete lines
counter1=93
[Table_Width]
;Width of Gui on screen, Set at 900
Col_Width=900
[Gui_Text_Height]
;put an s in front of Text Height, set at s10
Txt_Ht=s10
;put a w in front of Button_Widtht, set at w95
Button_Width=w95
[Gui_Table_Colour]
;=- Hex col is "FFA500" add "0x" to front of Hex colour
Gui_Colour=0xFFA500
[File_Type]
;=- Key = file extension  Value is Program with path to run the program, "in quotes"
;=- it som etinmes starts a new instance of the program instead of using what is open already
;=- Dir is Extension for a Folder, which will open in file explorer
pdf="C:\Program Files\Mozilla Firefox\firefox.exe"
txt="C:\Program Files\Notepad++\notepad++.exe"
xlsx="C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE"

Text Height, column width & Colour of stripes

These are 3 user variables to put in ini file, so that user can play with what style they wish to have. Text Height may affect button layout in which case they will need to alter button width to suit, there is a variable in the ini file to do this.

Possibly I should put some of the paths to files in the ini file, I’ll think about that

Buttons for Actions instead of hotkeys

When I was testing the script I was having to remember quite a few hotkeys, the labels method in AHK is nice as it allows for the GUI buttons to take care of those issues.

I’m sure I’ve used this method before, but as I pick up and put down programs I forget about them and have to relearn them. This is just one of those instances.

So more buttons and a note at the top to explain what the program is about.

Default button is select a file so will open to do so.

I tried colouring buttons and text, but the suggestion is to use images, which I don’t want to get into at this time. So they can stay as they are.

Help File/Web Page

I’ll think about this. Maybe setup a page on pir2.tk for it? And the time capture app too.A few diagrams pointing to items/tasks in the ini file & screen.

End comment

You can download current version of code HERE

A few tweeks and the app is starting to be workable. The buttons help and I have most on auto refresh so as soon as action happens it refreshes table to show event.

The Selection of Folders is inelegant. I’ve set it to C:\ so you have to really drill down to get what you want, and I have to switch to QAP to get.

The code is shaping up, I’m pleased with how its developing.

I’m wondering about a button to edit inii file so that they can add programs to extnsions

Currently working on help file and taskbar menu and will then look at compiling and creating a zip file.

Video on application

Other ideas to develop further

The program is usable in its current frm but a few ideas to progress it if it is used by others who want it developed further.

I think its worth having the path of the stored file in the .ini file as it will then be possible for people to store the Data file where they prefer.

I did do some searching for Filters and a lot of methods used a popup box so that you choose what you are searching for. I didn’t come across one that I thought was suitable, but there are methods for filtering the list.

I found AHK-Just Me’s Class_LV-InCellEdit that will allow you to edit the list directly. This could be a metho,d, using the existing process of my Delete function to write the list to a new file and then overwrite the original file. Sothat you have an on-screen edit./ It allows for protecting Columns so you could protect the path and othercolumn headers you don’t want to allow to be edited, but allow description to be edited. Also maybe number order, so that when you send to new file you can ave file numbering to pull older files to the to. As you are writing the list to a file and then reloading each time, as the file gets longer it could end up noticeably slowing the process down.

There is another AHk-Just Me’s LV-Ex class that allows you to group files into different groups, so that you can have sub groups to keep the files in, allowing you to collapse the e ones you are not interested in. You could use the project column (eg) to define which group you wanted a file/folder to be in. Also name the groups byu Project say, so it becomes a folder type structure.