Welcome Guest.   Make a donation to an author on the site April 18, 2014, 10:02:13 PM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
Your Support Funds this Site: View the Supporter Yearbook.
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1] 2 Next   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: IDEA: Allow commenting of files in directory listing  (Read 4479 times)
aurelius
Supporting Member
**
Posts: 7

View Profile Give some DonationCredits to this forum member
« on: August 22, 2011, 11:29:02 AM »

Greetings,
I was wondering if it would be possible to throw something together that would allow the addition of a comment section on directory listings. I keep all my downloaded files, sorted by month and year, and over time, many have similar names of files and many have cryptic names as well. I would like to be able to add a short text statement next to the file (or somewhere on the same line) that would make the file name more meaningful to me.

Right now, the standard fields are "Name", "Date modified", "Type" and "Size". It would be great to be able to add an inputable "Note" or "Comment" field that would accept text input and retain this information during backups etc. I believe XP either allowed me to do this or I had a toy that allowed this to happen. I am using Win 7 x64 Ultimate. Would be sweet if it were possible. ))

Thanx in advance.
Logged
skwire
Moderator
*****
Posts: 3,902



Another Coding Snack request? Om nom nom...

see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #1 on: August 22, 2011, 12:07:35 PM »

Yes, this is possible in WinXP:  http://tenmov.es/2008/03/...comments-to-files-win-xp/

I don't know if it works the same in Win 7.
Logged

aurelius
Supporting Member
**
Posts: 7

View Profile Give some DonationCredits to this forum member
« Reply #2 on: August 22, 2011, 02:42:51 PM »

Yeah, I thought so about XP. I think you can comment on MP3s and the such but not on other files (like .zip or .exe etc). I'm hoping one of 'smart folks' can solve this for Win 7 x64. ))
Logged
rjbull
Charter Member
***
Posts: 2,701

View Profile Give some DonationCredits to this forum member
« Reply #3 on: August 22, 2011, 03:41:20 PM »

 Would one of the file managers that use 4DOS-type DESCRIPT.ION suit your needs?  E.g. Total Commander?
Logged
aurelius
Supporting Member
**
Posts: 7

View Profile Give some DonationCredits to this forum member
« Reply #4 on: August 22, 2011, 10:58:48 PM »

I was hoping to avoid using another file manager, innocently hoped that someone would be able to figure out a registry solution. I really don't want to have to learn another program ((.
Logged
skwire
Moderator
*****
Posts: 3,902



Another Coding Snack request? Om nom nom...

see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #5 on: August 22, 2011, 11:15:48 PM »

I was hoping to avoid using another file manager, innocently hoped that someone would be able to figure out a registry solution.

This type of functionality is MUCH more than a simple registry change.  You may have some success with TaggedFrog.  It appears to work on Windows 7 x64 and integrates, somewhat, with Windows Explorer.
Logged

Target
Honorary Member
**
Posts: 1,361



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #6 on: August 22, 2011, 11:44:55 PM »

I was hoping to avoid using another file manager, innocently hoped that someone would be able to figure out a registry solution.

This type of functionality is MUCH more than a simple registry change.  You may have some success with TaggedFrog.  It appears to work on Windows 7 x64 and integrates, somewhat, with Windows Explorer.

or possibly Elyse?
Logged

"Look wise, say nothing, and grunt. Speech was given to conceal thought" - Sir William Osler
MilesAhead
Member
**
Posts: 4,451



View Profile Give some DonationCredits to this forum member
« Reply #7 on: August 23, 2011, 01:39:39 AM »

I worked on this for a number of years to comment my downloads in Explorer.  I wrote a 32 bit shell extension called TipOff.  But especially for 64 bit I came to the conclusion that there's really no good way of doing it unless you happen to have written a pretty comprehensive file manager.

You may get TipOff to work on 64 bit if you use it in a 32 bit file manager such as FreeCommander.  I wrote a small utility to launch 32 bit explorer in 64 bit Windows so that many of these 32 bit extensions would work.  I got the work-around from Microsoft site(launching 32 bit explorer from SysWow64 folder) but they later changed it so that there's no way to determine if the hard link would launch a 32 or 64 bit Explorer. I gave up at that point.

I haven't updated TipOff in awhile because I got tired of the silliness.  You can try it if you like:

http://www.favessoft.com/tipoff.html

Also I have a different approach.  Making a TreePadLite file for an entire folder and you fill in the descriptions later.  All the top level files are entered as nodes in the tree. I call it TreePadGen:

http://www.favessoft.com/downloads.html

The other way that may work semi-smoothly would be a tray app that watched the mouse in Explorer window.  Every time you selected a file it would use the name as an index into an associative array(map, hash, whatever) and show the comment in a tooltip.  You'd hit a hotkey to enter the description.  Not really smooth.  Another reason why I gave up because you really just want to select the file with the mouse and the comment mechanism be provided by the OS and/or file system.  It's clunky to do it from outside.

I don't work on this type application anymore as it's a case of been there, done that. I spent too much time already on something that can't really be done smoothly in Windows. I messed with it from around 2001 to a couple years ago.  That's enough for me. smiley


« Last Edit: August 23, 2011, 01:44:53 AM by MilesAhead » Logged

"I don’t want to belong to any club that would have me as a member."
 - Groucho Marx

MilesAhead
Member
**
Posts: 4,451



View Profile Give some DonationCredits to this forum member
« Reply #8 on: August 23, 2011, 02:00:46 AM »

An idea that may be helpful with the TreePadLite description file approach is to go the other way. Instead of commenting a file with a cryptic name, save the cryptic name as the comment in case you need to search the download at some later date, and rename the download file to something descriptive.

Especially when I download set up files that have names like SetUp_someappxyz_1465.msi  I put the descriptive filename first, then the fact it's a set up.  Like MakeMKV1614_Setup.exe instead of SetupMakeMKV1614.exe or however it comes from the site. It sorts better that way instead of looking through 200 files that start with SetUp__

Logged

"I don’t want to belong to any club that would have me as a member."
 - Groucho Marx

aurelius
Supporting Member
**
Posts: 7

View Profile Give some DonationCredits to this forum member
« Reply #9 on: August 23, 2011, 03:30:40 PM »

Uggg, no joy in a simple solution I see. I have renamed some downloaded files to make their association a little easier to retain their 'meaning' but nothing on a regular basis. (Sometimes what seems logical at time of downloads changes with the passing of time on my part.) Tagging would sort of help but not my desired solution. I use "Everything" to run file searches which helps root out files but this is dependent upon my remembering parts of file names and what not. The older I get the harder it is to remember them dang parts of titles, )). I will keep looking though.
Logged
IainB
Supporting Member
**
Posts: 4,280


Slartibartfarst

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #10 on: August 23, 2011, 04:34:42 PM »

@aurelius: You could do this (still can) using the old PCMagazine's free (giveaway) EN (Explorer Notes) v2.  smiley
A brilliant little tool, it was yet another example of Neil J. Rubenking's ingenuity.  thumbs up
I have put a copy of the file you need to run it all here, to download: Explorer Notes v2 - en2 (Ziff Davis).zip
Just copy the files into a directory.

The file contains:
  • the necessary proggies/DLL to run.
  • an extensive Help file (Neil J. Rubenking, again).
  • the install log file from my 1998 install (may be of use/interest).
  • a link to the PCMagazine website (you have to pay to download EN2 now, it seems).  Sad

Once you run EN2, "Use the Connect to Explorer" function for it to integrate into the Explorer shell. This shell integration worked fine in XP but does not yet work in my Win7 (64-bit). I intend to figure out how to fix this, but it's not top of my to do list yet - the install log file from my 1998 install may give a clue for me when I start fixing.
It worked fine when I originally used the EN v1, then v2. I had it running on Windows 95, then Windows 98, then Windows XP - it didn't need an installer, just the files per the above download.

EN uses the Registry as its database - which some people thought was a bit naughty. Mind you, xplorer² uses the Registry for similar reasons - for its "bookmarks" data.

EN is/was well-integrated with the Windows Explorer shell and with the OS, providing a comprehensive note manager. I gather it was compatible with all the 32-bit Windows platforms, but I'm not sure exactly what ts limitations are for 64-bit Windows platforms (as above).
Logged
MilesAhead
Member
**
Posts: 4,451



View Profile Give some DonationCredits to this forum member
« Reply #11 on: August 23, 2011, 06:48:03 PM »

I took a look at Explorer Notes as I was curious.  Somewhat similar to my TipOff except TipOff allows up to 4 kb of text in a comment rather than 255 characters.  Also TipOff comments can be multi-line.  When stored to file it filters out the cr/lf pairs and uses a tilde('~') in the file in their place to keep the data file simple alternating key/comment lines of text.

It's not a search engine.  When you select a file in Explorer, if it has been commented and is of the supported type:
.7z .arc, .arj, .cab, .exe, .gif, .gz, .jpg, .lzh,
  .msi, .rar, .rpm, .tar, .tgz, .txt, .Z, and .zip

The comment will show in a ToolTip.

Otherwise you right click the file, select Properties, then click the Comment Tab.  There's an EditBox where you can read and edit the comment.  You can use Enter and spaces to make comments appear somewhat aligned.

There's an adjustment in the Windows OS to set the ToolTip speed(mouse hover delay.)  See the help file.  But even when you decrease the delay it's not as smooth as I'd like it.  The ideal might be to have an app window open and send the comment to it.  But Explorer integration is really tough.  Especially when they insist on changing things every time a new Windows comes out.

I probably saw the Rubening utility as I used to subscribe to PC Mag back then.  Probably what inspired me to try to write my own. smiley

One big pita with this type of utility is moving the files. Due to the drive letter thing. I ended up putting in a shell extension to copy the files with the corresponding comments to another folder.  Also I put a data file in the current folder to get away from the drive letter being part of the key to the comment.  But it really needs to be part of the file system to be smooth in my opinion.

But as a quick test you might try using the Rubenking utility in a 32 bit file manager.  My 32 bit TipOff will work on 64 bit systems if using 32 bit FreeCommander instead of 64 bit Explorer.  The same is likely true of Rubenking's DLL. It's got to be a 32 bit shell extension.



« Last Edit: August 23, 2011, 06:53:03 PM by MilesAhead » Logged

"I don’t want to belong to any club that would have me as a member."
 - Groucho Marx

MilesAhead
Member
**
Posts: 4,451



View Profile Give some DonationCredits to this forum member
« Reply #12 on: August 23, 2011, 07:11:24 PM »

Uggg, no joy in a simple solution I see. I have renamed some downloaded files to make their association a little easier to retain their 'meaning' but nothing on a regular basis. (Sometimes what seems logical at time of downloads changes with the passing of time on my part.) Tagging would sort of help but not my desired solution. I use "Everything" to run file searches which helps root out files but this is dependent upon my remembering parts of file names and what not. The older I get the harder it is to remember them dang parts of titles, )). I will keep looking though.

I know what you mean. When using aliases in Windows to launch commands I often remember what the program does, but forget the alias as well as the program name. It can be frustrating.

Logged

"I don’t want to belong to any club that would have me as a member."
 - Groucho Marx

aurelius
Supporting Member
**
Posts: 7

View Profile Give some DonationCredits to this forum member
« Reply #13 on: August 24, 2011, 04:37:55 AM »

This shell integration worked fine in XP but does not yet work in my Win7 (64-bit). I intend to figure out how to fix this

IainB, this sort of defeats me as I am using the win 7 x64. (  but thanx for the tip thought. And I believe I am a member of the pcmag's site, just haven't been in a while. ))
Logged
bob99
Supporting Member
**
Posts: 316

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #14 on: August 24, 2011, 10:09:58 AM »


Would using the comment field in XYplorer be of help?  I'm still getting comfortable with all of the ins & outs of XY and just started utilizing it's comment field.  XYplorer uses it's own "Comment" field and not the Win Explorer's "Comments" one. But I noticed both are shown while doing a mouseover in XY.  And you can show the comments as a column in the folder/directory listing in XY.  For me, I also like that I can select multiple files in the folder and add the the same comment (or tag(s)) to all at the same time instead of one by one.
May be that some or all of the other file managers listed above can do this also.
Logged
IainB
Supporting Member
**
Posts: 4,280


Slartibartfarst

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #15 on: August 24, 2011, 12:38:33 PM »

@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:
Quote
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.
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.
Logged
JavaJones
Review 2.0 Designer
Charter Member
***
Posts: 2,514



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #16 on: August 24, 2011, 01:17:41 PM »

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
Logged

The New Adventures of Oshyan Greene - A life in pictures...
MilesAhead
Member
**
Posts: 4,451



View Profile Give some DonationCredits to this forum member
« Reply #17 on: August 24, 2011, 02:16:53 PM »

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.

[copy or print]
;
; 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
« Last Edit: August 24, 2011, 03:20:49 PM by MilesAhead » Logged

"I don’t want to belong to any club that would have me as a member."
 - Groucho Marx

MilesAhead
Member
**
Posts: 4,451



View Profile Give some DonationCredits to this forum member
« Reply #18 on: August 24, 2011, 06:52:06 PM »

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.

[copy or print]
/*
 * * * 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

Logged

"I don’t want to belong to any club that would have me as a member."
 - Groucho Marx

MilesAhead
Member
**
Posts: 4,451



View Profile Give some DonationCredits to this forum member
« Reply #19 on: August 24, 2011, 10:14:36 PM »

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

"I don’t want to belong to any club that would have me as a member."
 - Groucho Marx

IainB
Supporting Member
**
Posts: 4,280


Slartibartfarst

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #20 on: August 25, 2011, 02:14:57 AM »

@MilesAhead:
Where I said:
This shell integration worked fine in XP but does not yet work in my Win7 (64-bit). I intend to figure out how to fix this
- is your view that it cannot be fixed because the dll is a 32-bit one and needs to be made compatible with the OS as a 64-bit one?

By the way, what you have done re the AHK function looks very intereresting. Thankyou. I shall try it out.
I am using AutoHotkey_L latest version (64-bit).
Logged
MilesAhead
Member
**
Posts: 4,451



View Profile Give some DonationCredits to this forum member
« Reply #21 on: August 25, 2011, 02:58:59 AM »

To use 32 bit shell extensions on 64 bit OS you have to access via either a 32 bit file manager, such as FreeCommander etc., or the 32 bit Explorer.  Microsoft had a work-around.  They stored a 32 bit Explorer under SysWow64 folder.  If you launched it, most 32 bit shell extensions would work. That's why I wrote HalfShell hotkey app.  My 32 bit shell extensions, and other peoples, were working kick ass on Vista64.  Then I got word from people they weren't working on 64 bit W7.  Turns out, as I mentioned earlier, that the hard link was no longer guaranteed to go to a 32 bit Explorer.  Basically MS shot themselves in the foot but the bullet went through everyone using the work-around.

Maybe 64 bit compiler sales were slow since the 32 bit shell extensions were working? Wink

I'm updating my AHK doodad.  I've used the key/comment text data file for years.  But I never stress tested it with a lot of data.  If somebody could add some more efficient or robust data storage that would be a big bonus.  For simplicity I'm back to using the entire file path as key. In my TipOff program I only use the file name part with a comment file in each folder.  Probably not so necessary now since we seem to be back to the OS wanting to be on C: with Vista and W7. So the drive letter thing is less likely to break it.

A little more work and I'll post what I have for working AHK prototype.

Logged

"I don’t want to belong to any club that would have me as a member."
 - Groucho Marx

MilesAhead
Member
**
Posts: 4,451



View Profile Give some DonationCredits to this forum member
« Reply #22 on: August 25, 2011, 03:24:48 AM »

Here's my current version.  Initial testing seems ok.
To Toggle Arrow Keys enabled just double click Tray Icon.  Shows status in icon tooltip.

CommentExplorer.ahk

[copy or print]
/*
 * * * Compile_AHK SETTINGS BEGIN * * *

[AHK2EXE]
Exe_File=%In_Dir%\CommentExplorer.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
[ICONS]
Icon_1=%In_Dir%\C.ico

* * * Compile_AHK SETTINGS END * * *
*/

#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.
#Include MilesAhead.ahk
progname := _FileBaseName(A_ScriptFullPath)
tiptext := progname . "  ==> No"
Menu Tray,NoStandard
Menu Tray,Add,Donate,DoDonate
Menu Tray,Add,Visit Hotkey Page,DoVisit
Menu Tray,Add,About,DoAbout
Menu Tray,Add
Menu Tray,Add,Arrow ToolTips,ToggleTips
Menu Tray,Add
Menu Tray,Add,Quit,DoQuit
Menu Tray,Default,Arrow ToolTips
if (A_IsCompiled)
  Menu Tray,Icon,%A_ScriptFullPath%,1
Menu Tray,Tip,%tiptext%

ArrowsEnabled := 0

IniFile = %A_ScriptDir%\%A_ScriptName%
IniFile := RegExReplace(IniFile,"i)ahk$","ini")
IniFile := RegExReplace(IniFile,"i)exe$","ini")
IniRead,ArrowsOn,%IniFile%,Settings,ArrowsEnabled,1
if ArrowsOn
  gosub,ToggleTips

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 !ArrowsEnabled
    Return
  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

ToggleTips:
  ArrowsEnabled := !ArrowsEnabled
  Menu Tray,ToggleCheck,Arrow ToolTips
  if ArrowsEnabled
    tiptext := progname . "  ==> Yes"
  else
    tiptext := progname . "  ==> No"
  Menu Tray,Tip,%tiptext%
Return

DoAbout:
  FileGetVersion,filever,%progname%.exe
  MyMsg =
  (
%progname% v %filever% Copyright (c) 2011 www.FavesSoft.com`n
Use Up Down Arrows to see Comments in Explorer`n
Press Shift-F11 to Add Comment for a File`n
  )
  MsgBox, 4160, About %progname%, %MyMsg%
Return

DoDonate:
  Run,"http://www.favessoft.com/donate.html"
Return

DoVisit:
  Run,"http://www.favessoft.com/hotkeys.html"
Return

DoQuit:
  IniWrite,%ArrowsEnabled%,%IniFile%,Settings,ArrowsEnabled
  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

Logged

"I don’t want to belong to any club that would have me as a member."
 - Groucho Marx

MilesAhead
Member
**
Posts: 4,451



View Profile Give some DonationCredits to this forum member
« Reply #23 on: August 25, 2011, 04:27:11 PM »

Ok, I have a working app uploaded to my site. See this post for particulars:

http://www.donationcoder....27756.msg259555#msg259555

Instead of writing the comment file on program exit, I use the same trick I did on my shell extension.  Append new comment to the file.  On load dupes are replaced in the dictionary with the newest entry.

There are Compact and Purge commands in the Tray Menu to remove dupes and dead entries(the file was renamed or deleted/moved etc..)

edit: I wrote a small dummy file and comment generator to write 5000 temp files and comments.  It took a bit of time to write out the file so not a good choice to have the entire file written on program close.  That's why I changed to the append technique I mentioned above.  But the Purge and Compact commands seemed to work fine with progress bar(if 100 or more entries are in the dictionary.)  As a safeguard I use a flag to note when the comment file is being manipulated for any lengthy functions. The program Quit Command won't quit if the file access is busy(unless you log out or stop task with task manager or something.)  In any case it should take quite awhile to build up 5000 comments in normal usage.  Therefore I think this Hotkey approach is OK for manual use.


edit2: also note while file purge or compaction is going on the hotkeys are temporarily suspended.  You shouldn't even notice unless you try to use the hotkeys while the progress bar is updating. On my system 5000 dummy entries were processed in about 4 or 5 seconds so it shouldn't be an issue.
« Last Edit: August 25, 2011, 07:51:11 PM by MilesAhead » Logged

"I don’t want to belong to any club that would have me as a member."
 - Groucho Marx

MilesAhead
Member
**
Posts: 4,451



View Profile Give some DonationCredits to this forum member
« Reply #24 on: August 26, 2011, 06:55:59 PM »

The latest version of Comment Explorer is pretty usable now.  Only shows ToolTip if there's a comment.  It's shown at top left of window.  Time out for the ToolTip is adjustable via .ini file.

One thing I didn't like about my shell extension was waiting for mouse hover time to show the ToolTip.  By using Arrow Keys as trigger, the response time is nearly instant.
Also it's not dependent on Windows file types.  A comment can be entered for files of any type and folders.

Logged

"I don’t want to belong to any club that would have me as a member."
 - Groucho Marx

Pages: [1] 2 Next   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.052s | Server load: 0.07 ]