a suggestion about internal association
Moderators: Hacker, petermad, Stefan2, white
a suggestion about internal association
the internal association is a very interesting feature, it helps me to build my customize right-click menu and customize icons without edit windows Registry.
but some times I still meet problem, for example:
I define 3 file types *.c *.asm *.h, in order to get 3 different icons.
and I build internal right-click menu for all 3 types, the command is like this "edit with emeditor", "open in sourceinsight" ...
it works well if I select only 1 type of file at the same time. however, if I do a multiple selection, select some C and H files at the same time, I lost my right click menu.
even if I build another file type like this "*.c;*.asm;*.h", it didn't work as well.
Another example is that I am using a some tool "Unlocker" to unlock some opened files, I want to display it in the right-click menu of all files, it is also a impossible mission now, because of the similar reason.
My suggestion is: if we do a multiple file selection, and right click, we can try to match our selections with the file type entries one by one, if not matched or only partly matched, we can try to match the next entry. because some times we may need a different right-click menu when multiple selection.
is it possible to implement it?
but some times I still meet problem, for example:
I define 3 file types *.c *.asm *.h, in order to get 3 different icons.
and I build internal right-click menu for all 3 types, the command is like this "edit with emeditor", "open in sourceinsight" ...
it works well if I select only 1 type of file at the same time. however, if I do a multiple selection, select some C and H files at the same time, I lost my right click menu.
even if I build another file type like this "*.c;*.asm;*.h", it didn't work as well.
Another example is that I am using a some tool "Unlocker" to unlock some opened files, I want to display it in the right-click menu of all files, it is also a impossible mission now, because of the similar reason.
My suggestion is: if we do a multiple file selection, and right click, we can try to match our selections with the file type entries one by one, if not matched or only partly matched, we can try to match the next entry. because some times we may need a different right-click menu when multiple selection.
is it possible to implement it?
- ghisler(Author)
- Site Admin
- Posts: 50930
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Currently the function is only supported if all the selected files have the same extension. The problem is that although all the types have a verb "edit with emeditor", it may not be the same command.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
just as you said, I define tens of template such as *.c, *.h, *.cpp ......
in order to get a right click "edit by ...", I will have to modify all the templates, it is really a big job.
but as ghisler said, the problem is that even if we define the same verb for multiple template, it is not a good idea to combine them, because the real command maybe different.
so I think we can make a new template include several different files types.
I try it just now, if I define a new template with file type "*.c;*.h", and move the template to the top of internal association list, I can get my right-click menu even if I select multiple file of different extensions. but if I move the new template under my old template "*.c", the new template will not take effect.
so I think the most diffcult job has already been done, now we are able to select files of different extensions, and match them to one template - if the template support multiple extensions.
the real problem is that, multiple file selection may be matched with more then one templates, just as my example, when I select both C file and H file, my selection matched 3 templates at the same time: template "*.c", template "*.h", and template "*.c;*.h", which template will take effect just depend on their order in the internal association list.
So I guess maybe it is possible to modify the match method: when we do a multiple selection with C file and H file, we can go through all the templates one by one, we may meet the template "*.c" at first, it is not perfectly matched our selection, we can skip it, and try to match the next template, finally we will reach the template "*.c;*.h", it is perfectly match our selection, and we can use this template to show the correct right-click menu.
in order to get a right click "edit by ...", I will have to modify all the templates, it is really a big job.
but as ghisler said, the problem is that even if we define the same verb for multiple template, it is not a good idea to combine them, because the real command maybe different.
so I think we can make a new template include several different files types.
I try it just now, if I define a new template with file type "*.c;*.h", and move the template to the top of internal association list, I can get my right-click menu even if I select multiple file of different extensions. but if I move the new template under my old template "*.c", the new template will not take effect.
so I think the most diffcult job has already been done, now we are able to select files of different extensions, and match them to one template - if the template support multiple extensions.
the real problem is that, multiple file selection may be matched with more then one templates, just as my example, when I select both C file and H file, my selection matched 3 templates at the same time: template "*.c", template "*.h", and template "*.c;*.h", which template will take effect just depend on their order in the internal association list.
So I guess maybe it is possible to modify the match method: when we do a multiple selection with C file and H file, we can go through all the templates one by one, we may meet the template "*.c" at first, it is not perfectly matched our selection, we can skip it, and try to match the next template, finally we will reach the template "*.c;*.h", it is perfectly match our selection, and we can use this template to show the correct right-click menu.
- ghisler(Author)
- Site Admin
- Posts: 50930
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
That's an interesting idea: this way I wouldn't have to combine multiple templates, but just continue to search for one which matches all files.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
- ghisler(Author)
- Site Admin
- Posts: 50930
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
I have already added it to RC4 because it went well into the existing function. Could you try it, please?
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Hi,
I have been using this new feature for several days, most time it works well, but sometimes it didn't work.
finally I find the reason today:
the file matching mechanism is a little different from my supposition before.
I can not describe it well, and I try to use a example.
I create 3 files in a folder: 1.ini, 2.txt, 3.ini. and sort them by file name.
I have 2 internal association templates, 1: (*.txt), 2: (all files). template_2 is under template_1
my test result is:
select 1.ini : match template (all files)
select 2.txt : match template (*.txt)
select 3.ini : match template (all files)
select 1.ini, 2.txt : don't match any template
select 2.txt, 3.ini : match template (all files)
select 1.ini, 3.ini : match template (all files)
select 1.ini, 2.txt, 3.ini : don't match any template
it seems file matching has a small problem, I don't know the detail, hope my test result will do some help.
I have been using this new feature for several days, most time it works well, but sometimes it didn't work.
finally I find the reason today:
the file matching mechanism is a little different from my supposition before.
I can not describe it well, and I try to use a example.
I create 3 files in a folder: 1.ini, 2.txt, 3.ini. and sort them by file name.
I have 2 internal association templates, 1: (*.txt), 2: (all files). template_2 is under template_1
my test result is:
select 1.ini : match template (all files)
select 2.txt : match template (*.txt)
select 3.ini : match template (all files)
select 1.ini, 2.txt : don't match any template
select 2.txt, 3.ini : match template (all files)
select 1.ini, 3.ini : match template (all files)
select 1.ini, 2.txt, 3.ini : don't match any template
it seems file matching has a small problem, I don't know the detail, hope my test result will do some help.
- ghisler(Author)
- Site Admin
- Posts: 50930
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Thanks, I will check it in the debugger with your test cases. I didn't encounter such a problem with my tests.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
- ghisler(Author)
- Site Admin
- Posts: 50930
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Thanks for your feedback, nice to hear that it works now!
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com