ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

IDEA: Allow commenting of files in directory listing

<< < (4/6) > >>

IainB:
@bob99:
I use xplorer² file manager (Windows Explorer replacement). That has 2 comments fields - one (A) seems to be peculiar to xplorer², and the other (B) is a system one. For a JPG file, if you write/edit a comment in (A), it appears in (B), but it does not appear in either the EXIF or IPTC info of the file.

xplorer² has this note about using Comments:
File comments rely on an advanced NTFS feature called “Alternate Data Streams” (ADS). Imagine a file as a kind of "folder" that has a stream for the regular contents and secondary streams for other information, including comments. When you move the file around, all these alternate streams are silently carried along.
--- End quote ---
What that means is that if you run a file backup to a non-NTFS disk, then you will strip off the ADS (Comment) data.
There is no manager for the Comments, so you have to display them in the file manager, though xplorer² says you can export the comments and file names to a spreadsheet for analysis.

One of the things I liked about Rubenking's Explorer Notes was that it incorporated quite a sophisticated file manager, so you could browse through all your Comments in the file manager.

JavaJones:
Man, this is what meta data is *for*. I really hoped for better support of it in Win7. For example there is a "comments" meta data field you can optionally display in Win7 explorer, but editing it? Forget about it. Granted not all file types support the same meta data, or any at all, so it kind of needs to be an OS-level thing or involve "sidecar" files. But really I was hoping for some improvement here. I guess this is something that OS X may actually handle better than Windows (since its file handling has included "sidecar" type meta data files for ages)?

- Oshyan

MilesAhead:
The display in ToolTip in Explorer can be done with AHK I think.  I have a test stub that displays the filename when you use Up and Down Arrows in Explorer.  But I don't know enough about using either SQLlite or Scripting.Dictionary or native associative arrays in AHK to use the filename to look up the comment.

The OP mentioned the desire to search, which is another difficulty.  Using TreePad files with comments one can search the entire TreePad file using Control-f.  Also one can make a "master" TreePad file by importing the TreePad comment file for each directory, thereby enabling a system wide search.  But it would be a bit cumbersome unless one is adept at TreePad.  I couldn't find any command line switch to open a TreePad file to a search.

Here's the test stub I have so far.  It may be desirable to get rid of the code that saves the clipboard contents at each hotkey press as it will likely slow things down when fetching the comment.  Maybe have a menu option to disable the Up and Down Arrow monitoring so as not to interfere when using the clipboard for stuff.


--- ---;
; Demonstrates showing a ToolTip as Up and Down Arrows
; are used in Explorer.
;
; The next step is to use the filename to look up a
; comment associated with the file.  The ToolTip should
; display that, if it exists, instead of the filename.
;
; Step after that would be a method to enter a comment for
; the selected file and store it in an associative array
; or use some database engine.  For a few thousand comments
; Scripting.Dictionary may work, or AHK associative arrays.
;
; MilesAhead
;
#SingleInstance ignore
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

GroupAdd,ExplorerGroup, ahk_class CabinetWClass
GroupAdd,ExplorerGroup, ahk_class ExploreWClass
TipActive := 0

#IfWinActive, ahk_Group ExplorerGroup
~Up::
~Down::
  if TipActive
     gosub,ClearTip
  ClipSaved := ClipboardAll ; save entire clipboard
  Clipboard= ; clear clipboard
  Send ^c
  ClipWait,0
  ToolTip,%Clipboard%
  Clipboard := ClipSaved
  ClipSaved = ; free memory
  TipActive := 1
  SetTimer,ClearTip,-4000
Return

ClearTip:
  if TipActive
  {
    ToolTip
    TipActive := 0
  }
Return

MilesAhead:
Okay, here's a start on a working program. To hold lots of comments it may be preferable to use a db engine.  For this demo a text file of alternating keys/comments is used.

It should work on any Windows with Scripting.Dictionary regardless of the "bitness" of the OS.


--- ---/*
 * * * Compile_AHK SETTINGS BEGIN * * *

[AHK2EXE]
Exe_File=%In_Dir%\CommentExp.exe
No_UPX=1
[VERSION]
Set_Version_Info=1
File_Version=1.0.0.0
Inc_File_Version=0
Product_Version=1.0.0.0

* * * Compile_AHK SETTINGS END * * *
*/

; CommentExp.ahk
;
; Crude start to displaying comments in Explorer
; regardles of "bitness" of the OS.
;
; Should work on any Windows with Scripting.Dictionary
;
; When the Up and Down Arrow keys are used in an
; Explorer Window, a ToolTip will show near the Mouse.
;
; If there is a commment for the file, it is shown.
; Otherwise the filename is displayed.
;
; Press Shift-F11 to add a comment for a flle.
;
; Comments.txt is written in the same folder as
; CommentExp.exe and read back on program run.
;
; Possible enhancements: Use db engine instead of
; just a text file of alternating keys/comments.
;
; It's free for you to modify for your own use at
; your own risk.
;
; MilesAhead
;
#SingleInstance ignore
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
OnExit,SaveAndQuit
GroupAdd,ExplorerGroup, ahk_class CabinetWClass
GroupAdd,ExplorerGroup, ahk_class ExploreWClass
TipActive := 0
FileName := ""
CommentFile := "Comments.txt"
sd := ComObjCreate("Scripting.Dictionary")
gosub,ReadCommentFile

#IfWinActive, ahk_Group ExplorerGroup
~Up::
~Down::
  if TipActive
     gosub,ClearTip
  Clipboard= ; clear clipboard
  Send ^c
  ClipWait,0
  if sd.exists(Clipboard)
   {
      str := sd.item(Clipboard)
      ToolTip,%str%
   }
  else
   ToolTip,%Clipboard%
  TipActive := 1
  SetTimer,ClearTip,-4000
Return

+F11::
  Clipboard= ; clear
  Send ^c
  ClipWait,0
  FileName := Clipboard
  str := ""
  if sd.exists(FileName)
   str := sd.item(FileName)
  InputBox,Comment,,Enter Comment,,,,,,,,%str%
  if ErrorLevel
   Return
  sd.item(FileName) := Comment
Return


ClearTip:
  if TipActive
  {
    ToolTip
    TipActive := 0
  }
Return

ReadCommentFile:
  IfNotExist,%CommentFile%
   Return
  FileRead,Contents,%CommentFile%
  if Contents=
   Return
  Loop, parse, Contents, `n, `r
  {
   if Mod(A_Index,2)
      keystr := A_LoopField
   else
      sd.item(keystr) := A_LoopField
  }
Return
  
SaveAndQuit:
  IfExist,%CommentFile%
   FileDelete,%CommentFile%
  for k, v in sd.Keys()
  {
   if sd.exists(k)
   {
    FileAppend,%k%`n,%CommentFile%
    str := sd.item(k)
    FileAppend,%str%`n,%CommentFile%
   }
  }
  sd := 0
ExitApp

MilesAhead:
I should mention I'm compiling the above with AutoHotkey_L latest version.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version