NiftyLink addon - Links using internal associations and more

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Juergen
Power Member
Power Member
Posts: 517
Joined: 2003-05-02, 18:19 UTC
Location: Berlin (Germany)
Contact:

Post by *Juergen »

Hello sgp,

thank you for testing the beta version.
sgp wrote:
  • I have internal associations for .zip archives. The niftylink create dialog disables field "with this command associated internally in TC" for .zip archives. Can you enable it?
The program does not handle ZIP archives in a special way. When you are going to create a link to a file, the program looks for all internal TC commands that are associatated with it, and offers them all in the combobox of the 3rd option of the create dialog, so that you can make your choice. If the program does not find any associated internal commands, then the 3rd option is completely disabled, because then this option actually does not exist for that particular target file. Since the program obviously can't find your internal associations for ZIP archives (and PDF files), it disables the 3rd option for these files.
sgp wrote:
  • [...] So I'm inclined to think that NiftyLink gets confused with my setup, which uses redirection= (this has been discussed in this thread recently). In my setup, I keep sections [searches] and [associations] in a separate .ini file associations-searches.ini, and wincmd.ini redirects both sections with redirect=associations-searches.ini.
According to what I found in the TC documentation, my program looks for RedirectSection= in "Wincmd.ini". If you actually use "redirection=" or "redirect=", it cannot work with NiftyLink.exe.

Yes, this has been discussed before, but the program, can read redirected INI sections, and also I had the impression that with version 1.04 everything works fine for you, doesn't it?. In version 1.10 beta 1, I did not change the part of the program that reads internal TC associations. So I don't know whats going on on your system. BTW: What TC version are you using (7.57a or 8.0)?

I just tested it here again with version 7.57a: moved the sections [Associations] and [Searches] from "Wincmdi.ini" to a separate file called "associations-searches.ini". And in my "Wincmd.ini", it reads now:

Code: Select all

[Associations]
RedirectSection=associations-searches.ini

[Searches]
RedirectSection=associations-searches.ini
I have dozens of test links here, and they all worked correctly before and after the redirection.

I think it could help, if you show me your [Associations] section. It's probably best to send it to me by mail for the sake of privacy.

Regards, Juergen
My add-ons and plugins for TC: NiftyLink, mbox, Sequences
sgp
Senior Member
Senior Member
Posts: 355
Joined: 2005-01-31, 16:04 UTC

Post by *sgp »

Juergen wrote: I think it could help, if you show me your [Associations] section.
Here's an extract, does it work for you? If you don't have PeaZip (freeware, portable) just replace with notepad or what have you

wincmd.ini
[Associations]
RedirectSection=associations-searches.ini
[Searches]
RedirectSection=associations-searches.ini
association-searches.ini (cutout)
[searches]
; ----- archive-compressed
;FilterX=>archive-compressed
;FilterX.icon=%COMMANDER_PATH%\..\PeaZip\PeaZip.exe
;FilterX_peazip=""%COMMANDER_PATH%\..\PeaZip\PeaZip.exe" "%1""
archive-compressed_SearchFor=*.rar *.zip
archive-compressed_SearchIn=
archive-compressed_SearchText=
archive-compressed_SearchFlags=0|000002000020|||||||||0000|
[Associations]
Filter1=>archive-compressed
Filter1.icon=%COMMANDER_PATH%\..\PeaZip\PeaZip.exe
Filter1_peazip=""%COMMANDER_PATH%\..\PeaZip\PeaZip.exe" "%1""
P.S. My real association-searches.ini is much longer than this.
Juergen
Power Member
Power Member
Posts: 517
Joined: 2003-05-02, 18:19 UTC
Location: Berlin (Germany)
Contact:

Post by *Juergen »

That clears up the mystery. :)

[Searches] is currently not supported by NiftyLink. This means, that an entry such as Filter1=>archive-compressed in the [Associations] section is ignored, because it is a pointer to the [Searches] section. I mentioned somewhere in this thread that [Searches] is not supported, but that short statement is hidden somewhere in all the pages of this thread. Unfortunately, I forgot to write it in the documentation. I'm sorry. :oops:

If the respective entry would read

Code: Select all

[Associations]
Filter1=*.rar; *.zip
Filter1.icon=%COMMANDER_PATH%\..\PeaZip\PeaZip.exe
Filter1_peazip=""%COMMANDER_PATH%\..\PeaZip\PeaZip.exe" "%1""

then it would work as expected.

Regards, Juergen
My add-ons and plugins for TC: NiftyLink, mbox, Sequences
sgp
Senior Member
Senior Member
Posts: 355
Joined: 2005-01-31, 16:04 UTC

Post by *sgp »

That explains it, and the way it is is OK for now. But do you think you will include support for [searches] in a future upgrade?
User avatar
KC_
Junior Member
Junior Member
Posts: 94
Joined: 2012-03-07, 01:39 UTC

Post by *KC_ »

Juergen wrote:That clears up the mystery. :)

[Searches] is currently not supported by NiftyLink. This means, that an entry such as Filter1=>archive-compressed in the [Associations] section is ignored, because it is a pointer to the [Searches] section. I mentioned somewhere in this thread that [Searches] is not supported, but that short statement is hidden somewhere in all the pages of this thread. Unfortunately, I forgot to write it in the documentation. I'm sorry. :oops:

If the respective entry would read

Code: Select all

[Associations]
Filter1=*.rar; *.zip
Filter1.icon=%COMMANDER_PATH%\..\PeaZip\PeaZip.exe
Filter1_peazip=""%COMMANDER_PATH%\..\PeaZip\PeaZip.exe" "%1""

then it would work as expected.

Regards, Juergen
Thanks, that answered my colorful post :lol: (in the previous page).

That's why some of my internal associations were not working because they were under a pre-defined Saved Search.
# 251045
Total Commander 10.5 64bit
User avatar
robinsiebler
Senior Member
Senior Member
Posts: 460
Joined: 2003-03-05, 21:04 UTC

School Me!

Post by *robinsiebler »

A long time ago, I created a context menu item for TC using PowerPro. My context menu would perform commands (for archive files) like "extract here", "extract in a subdir here", "extract in the opposite pane", etc.

I'm guessing that all of this functionality could be recreated using Nifty Links and Internal Associations. However, I have no clue how to go about it. Could someone give me a quick example?

Thanks! :D
Robin L. Siebler
Personal License #13949
------------------------------
"Bother", said Pooh, as he deleted Windows
sgp
Senior Member
Senior Member
Posts: 355
Joined: 2005-01-31, 16:04 UTC

Re: School Me!

Post by *sgp »

robinsiebler wrote:A long time ago, I created a context menu item for TC using PowerPro. My context menu would perform commands (for archive files) like "extract here", "extract in a subdir here", "extract in the opposite pane", etc.

I'm guessing that all of this functionality could be recreated using Nifty Links and Internal Associations. However, I have no clue how to go about it. Could someone give me a quick example?

Thanks! :D
I think internal associations should suffice for your needs, look at some examples here http://www.ghisler.ch/wiki/index.php?title=Internal_File_Associations_Tutorial
Juergen
Power Member
Power Member
Posts: 517
Joined: 2003-05-02, 18:19 UTC
Location: Berlin (Germany)
Contact:

Post by *Juergen »

sgp wrote:But do you think you will include support for [searches] in a future upgrade?
I'm not sure right now. Do you want all search possibilities to be included?

Code: Select all

Search for
Search in
RegEx
Subdirectories
Find text
   Whole words only
   Case sensitive
   ...
Date between / not older than
...
I don't know a way how I could cause Total Commander to tell my program, whether a given file or directory (i.e. target of a NiftyLink) matches the criteria that a user has chosen for all those possible search categories.
That means, I would have to implement all the needed functionality myself in my program: Check whether the link target is in a given (sub)directory, whether it matches a given Regular Expression, whether it contains some particular text (maybe whole words only and/or case sensitive) etc... This is possible, and is mainly a question of how much time I have for working on it.

But does it really make sense, when for instance a file with extension .TXT on drive C: which is not older than 1 week would be associated with program A, a file with the same extension on drive D: which is older than 1 week and is bigger than 50 KB would be associated with program B, and all other files with that extension would be associated with program C?

BTW, sgp: I wasn't aware that you wrote an Internal File Associations Tutorial. That's great!


KC_ wrote:Thanks, that answered my colorful post :lol: (in the previous page).
Yes, that answered it. I believed that I had already answered it in my immediate reply to that post:
Juergen wrote:[Searches] are not suppored by he program.
I see now, that I wrote "suppored". :lol: Maybe that wasn't understandable? Should be "supported", of course.



2robinsiebler:
I agree with sgp: Internal associations should suffice for your needs. I can't see how NiftyLinks could be of benefit for your purpose.

Regards, Juergen
My add-ons and plugins for TC: NiftyLink, mbox, Sequences
sgp
Senior Member
Senior Member
Posts: 355
Joined: 2005-01-31, 16:04 UTC

Post by *sgp »

Juergen wrote:
sgp wrote:But do you think you will include support for [searches] in a future upgrade?
I'm not sure right now. Do you want all search possibilities to be included? ... I would have to implement all the needed functionality myself in my program ... But does it really make sense?
I thought TC was expanding searches for NiftyLinks. Well, then no, unless TC can expand the search for NiftyLink, I don't think NiftyLink should support [searches] - it would be a can of worms trying to replicate all that complexity in your program. Leave it the way it is. It's too bad for me, because my association-searches file is entirely based on searches... but I'll take the hit :) don't worry.

BTW, my tutorial references NiftyLinks. Maybe I should remove the reference at this point. Or at least clarify that none of the examples therein can work with NiftyLinks, or maybe again just link this post as an additional reference. Any preference?
Juergen
Power Member
Power Member
Posts: 517
Joined: 2003-05-02, 18:19 UTC
Location: Berlin (Germany)
Contact:

Post by *Juergen »

sgp wrote:it would be a can of worms trying to replicate all that complexity in your program.
Yes, exactly.
sgp wrote:Leave it the way it is. It's too bad for me, because my association-searches file is entirely based on searches... but I'll take the hit :) don't worry.
Thanks for your kind words.
However, I understand well that missing support for [Searches] is a problem. Would it help, if NiftyLink would offer partial support for [Searches], i.e. handle the list of filename patterns after xyz_SearchFor=, but ignore the entries xyz_SearchIn=, xyz_SearchText=, xyz_SearchFlags= ?
sgp wrote:BTW, my tutorial references NiftyLinks. Maybe I should remove the reference at this point. Or at least clarify that none of the examples therein can work with NiftyLinks, or maybe again just link this post as an additional reference. Any preference?
Thanks for asking. Of course I was pleased to see that your tutorial references NiftyLinks. :) However, if you think the reference should be removed, that won't be a problem for me. From a didactic point of view, I think it would be good at least to mention that NiftyLinks do not support all the tricks which you provide there. What NiftyLinks actually will support in version 1.10 will depend on the result of this discussion. :)

Regards, Juergen
My add-ons and plugins for TC: NiftyLink, mbox, Sequences
sgp
Senior Member
Senior Member
Posts: 355
Joined: 2005-01-31, 16:04 UTC

Post by *sgp »

Juergen wrote:
sgp wrote:Would it help, if NiftyLink would offer partial support for [Searches], i.e. handle the list of filename patterns after xyz_SearchFor=, but ignore the entries xyz_SearchIn=, xyz_SearchText=, xyz_SearchFlags= ?
It would help, of course. I think that you need to consider both Search_For= and Search_Flags= - the latter with some limitations. All other Search_*= should be ignored. The goal is to be able to recognize files and folders with wildcards and regular expressions (the latter only if your programming language has regex support). I'm not sure if you should also recognize exclusion patterns, probably not.

Looking at my searches.ini file, I found three test cases:
; ----- dir (folders)

dir_SearchFor=
dir_SearchFlags=0|000002000020||||||||22221|0000|
; ----- dir (folders) - alternative - no need to implement this
;dir_SearchFor=
;dir_SearchFlags=0|000002000020|||||||||0000|
;dir_plugin=tc.directory = 1

; ----- movie-thumbs - before image!

movie-thumbs_SearchFor=(avi|divx|mp4|mpg|mkv|wmv|mp3).jpg
movie-thumbs_SearchIn=
movie-thumbs_SearchText=
movie-thumbs_SearchFlags=0|000002001020|||||||||0000|

; ----- image - after movie-thumbs!

image_SearchFor=*.bmp *.crw *.dng *.gif *.jpg *.png *.psd *.tif
image_SearchIn=
image_SearchText=
image_SearchFlags=0|000002000020|||||||||0000
By omitting all other Search_*= fields, there's always the possibility of turning up some search results that TC wouldn't return, but I think it's a minor issue, which a user could easily ignore. After all, returning extra matches just impacts the length of the list of possible associations that the creation dialog presents.
Juergen
Power Member
Power Member
Posts: 517
Joined: 2003-05-02, 18:19 UTC
Location: Berlin (Germany)
Contact:

Post by *Juergen »

OK, I'll build some support for [searches] into the next beta version.

Regards, Juergen
My add-ons and plugins for TC: NiftyLink, mbox, Sequences
Juergen
Power Member
Power Member
Posts: 517
Joined: 2003-05-02, 18:19 UTC
Location: Berlin (Germany)
Contact:

Post by *Juergen »

sgp wrote:After all, returning extra matches just impacts the length of the list of possible associations that the creation dialog presents.
If I understand correctly what you mean, then I have to disagree. :-) (I hope I can express myself properly in English.)
Total Commander does not collect all actions ("verbs") from all matching filters, but only takes the first matching filter (with the actions that belong to it) into account. And so does NiftyLink. If a filter is changed so that it returns extra matches, this increases the probability that a given file name will match this filter, and so at the same time decreases the probability that this file name will be compared with subsequent filters. But the list which TC's right-click menü (or NiftyLink's creation dialog) presents always contains all actions that belong to the matching filter.

Regards, Juergen
My add-ons and plugins for TC: NiftyLink, mbox, Sequences
Juergen
Power Member
Power Member
Posts: 517
Joined: 2003-05-02, 18:19 UTC
Location: Berlin (Germany)
Contact:

Post by *Juergen »

New version 1.10 beta 2 released (only for testing): http://luethje.eu/prog/niftylink110_beta2.zip

fixed
  • Error checking was too strict in one case, so that a wrong error message was raised.
  • In the section [Associations] of the file "wincmd.ini", lists of filename patterns were only recognized correctly if the patterns were separated by semicolons. Now they can also be separated by blanks.
  • Some minor issues.
new
  • When creating links to directories, now also the new extended dialog is used.
  • In internal associations now also filename patterns that contain blanks are supported. Such a pattern must be enclosed in "".
  • In a list of filename patterns in internal associations, now the character | is taken into account. After | follow the patterns, which should NOT match the given file or directory name.
  • Now there is partial support for "predefined selection types" in internal associations, as they are defined in the section [Searches] of Total Commander's configuration.
    After SearchFor=, there can also be a Regular Expression (PCRE) instead of a list of filename patterns.
    If this entry is empty, ANY name will match.
    In the entry after SearchFlags=, it will be checked whether the search filter is a Regular Expression, and whether only files, only directories, or both files and directories should match.
    SearchIn= and SearchText= are ignored.
  • When creating a NiftyLink without Total Commander, the simplified dialog that is shown now also contains the field for entering a comment.
Note: The programming language which I use for this project has built-in support for PCRE. So I'm using this Regular Expression library, but it is not the same RegEx library that TC uses. Regular Expressions can be very complex and tricky, and because of using different libraries, it might be that there are cases where a Regular Expression is interpreted differently by TC and by NiftyLink.

The main documentation is not yet complete, so for the new features see the above list or the file "history.txt".

Regards, Juergen
My add-ons and plugins for TC: NiftyLink, mbox, Sequences
sgp
Senior Member
Senior Member
Posts: 355
Joined: 2005-01-31, 16:04 UTC

Post by *sgp »

Juergen wrote: If I understand correctly what you mean, then I have to disagree. :-) (I hope I can express myself properly in English.) ...
Well expressed. I stand corrected :)
Post Reply