How to merge comments in descript.ion with text files?

English support forum

Moderators: Hacker, petermad, Stefan2, white

hi5
Power Member
Power Member
Posts: 642
Joined: 2012-11-03, 11:35 UTC
Contact:

Post by *hi5 »

I guess by selected files you mean selected folders? Or actually just selected files that tries to read the descript.ion and search for the comment? Please explain.

Button bar is fairly easy as you can pass on parameters to AHK script.
F4MiniMenu (Forum) - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey). TCSyncComments (copy file comments)
sorcar
Member
Member
Posts: 100
Joined: 2005-04-12, 17:45 UTC
Location: U.S.

Post by *sorcar »

It is just selected files that I want the script to read from the descript.ion file, search for the comments, and append them.

Also, can I keep the ahk script in a different folder from where it can be executed through the button bar?

It may be fairly easy, though not necessarily for me!
hi5
Power Member
Power Member
Posts: 642
Joined: 2012-11-03, 11:35 UTC
Contact:

Post by *hi5 »

Will you select files in Branch view mode and / or Search results (after feed to listbox)? Or just selected files in the current folder?
F4MiniMenu (Forum) - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey). TCSyncComments (copy file comments)
sorcar
Member
Member
Posts: 100
Joined: 2005-04-12, 17:45 UTC
Location: U.S.

Post by *sorcar »

Just selecting the file in the current folder will suffice my purpose.

Being able to select after flattening the directories (Ctrl+B) will be great, but not necessary if complicated.

Thanks and regards.
hi5
Power Member
Power Member
Posts: 642
Joined: 2012-11-03, 11:35 UTC
Contact:

Post by *hi5 »

You can try this, code posted as a gist just in case it needs further edits, easier to edit as posting code again and again on the forum here:

https://gist.github.com/hi5/4dbd52c304c4c24f183ff26d185df23f

TC Button bar, add a new button:

Command: pathto\MergeComments.ahk
Parameters: %L

You can put the script anywhere you like so it no longer has to be in the current or parent folder. Select one or more files either in current folder or branch view or search results and click the button.

Should work.
F4MiniMenu (Forum) - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey). TCSyncComments (copy file comments)
sorcar
Member
Member
Posts: 100
Joined: 2005-04-12, 17:45 UTC
Location: U.S.

Code works!

Post by *sorcar »

It surely works - on all the modes. And the addition of a dialog box has really made it useful.

One issue: if placed on a directory, with or without comments, it reports "1 file(s) processed", but without really processing anything. This is not a problem for me, but a new user may find it somewhat misleading.
hi5
Power Member
Power Member
Posts: 642
Joined: 2012-11-03, 11:35 UTC
Contact:

Post by *hi5 »

Added a check to skip directories if they are selected so selecting 1 folder and 2 files will now say 2 files processed, not 3.
F4MiniMenu (Forum) - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey). TCSyncComments (copy file comments)
sorcar
Member
Member
Posts: 100
Joined: 2005-04-12, 17:45 UTC
Location: U.S.

Post by *sorcar »

This is now working fine. Thanks.

The other script that you wrote (one that goes through sub-directories, after changing to Loop, Files, *, DS) also works well and is quite useful.

I ran it through 9,000+ files. But a lack of dialog box left me wondering if the script was working. I hit enter a second time, resulting in appending the comments twice (as expected).

Addition of a dialogue box -- a box that counts and shows progress, and disappear after action is complete -- will greatly improve the usability of that script.
hi5
Power Member
Power Member
Posts: 642
Joined: 2012-11-03, 11:35 UTC
Contact:

Post by *hi5 »

Changed the script. You can now use this script to do it all.

Usage:

- Either select files (can be current folder, branch view and search results (after feed to listbox)) and press the button (as before)

- To process all files in the CURRENT and SUB folders place the cursor (highlighted file) on the [..] (parent dir) at the very top of the active panel, press the button. Confirm you want to process all files or cancel the script.

Now includes progress bar, if you only have a handful of files it will hardly be visible, if you have many, you should see it move.
F4MiniMenu (Forum) - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey). TCSyncComments (copy file comments)
sorcar
Member
Member
Posts: 100
Joined: 2005-04-12, 17:45 UTC
Location: U.S.

All functions in one ahk script

Post by *sorcar »

I did not think that it would be possible to combine all these functions in a single script. But you have done it very well. It now works in all modes (single file, multiple file selection, all sub-directories or on search results in a list box). Amazing!:D

You may consider posting it to http://www.ghisler.ch/wiki/index.php/AutoHotkey for others to benefit from.

Thank you very, very much.
hi5
Power Member
Power Member
Posts: 642
Joined: 2012-11-03, 11:35 UTC
Contact:

Post by *hi5 »

Glad you find it useful.

It could still be improved, for example only allow certain extensions to be processed (text, bat, cmd etc) so you can't accidentally corrupt binary files (word, jpg etc), generating a log file, etc.

But I think this is probably a very specific wish which is suitable for you but I doubt there will be many other who need it.

Edit: added log file + extensions.
F4MiniMenu (Forum) - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey). TCSyncComments (copy file comments)
sorcar
Member
Member
Posts: 100
Joined: 2005-04-12, 17:45 UTC
Location: U.S.

Post by *sorcar »

It could still be improved, for example only allow certain extensions to be processed (text, bat, cmd etc)
With the feature the script now has, I can use TC features, like directory flattening (Ctrl+B) and filtering (Ctrl+F12) conveniently to achieve that end. Running it recursively will be needed only in a few instances.

I did not know that it FileAppend could corrupt not text files - I should be careful.
I doubt there will be many other who need it.
Sadly, not many might have found it useful. If I could only list how the descript.ion feature could be used in so many convenient ways!

File commenting is one of the top 5 features in TC that I have been using for years now. There should be a separate forum where one can list innovative uses one finds for others to benefit from.
Last edited by sorcar on 2016-04-17, 07:36 UTC, edited 1 time in total.
sorcar
Member
Member
Posts: 100
Joined: 2005-04-12, 17:45 UTC
Location: U.S.

Post by *sorcar »

I have found that changing a line of the script to:

Code: Select all

FileAppend, `n%clipboard%%Comment%, %Folder%%FileName%
..conveniently adds clipboard text between the text file and the comment. This is useful and elegant way, rather than editing the script every time.

Can you add a few lines to the script so that it asks if to add the content of the clipboard?

Thanks.
hi5
Power Member
Power Member
Posts: 642
Joined: 2012-11-03, 11:35 UTC
Contact:

Post by *hi5 »

Made a small Gui with checkboxes
F4MiniMenu (Forum) - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey). TCSyncComments (copy file comments)
sorcar
Member
Member
Posts: 100
Joined: 2005-04-12, 17:45 UTC
Location: U.S.

Completion of the script.

Post by *sorcar »

It is real fast. And that with a log file too.

Thank you hi5. I guess I have nothing else to ask for.
Post Reply