topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday December 12, 2024, 8:51 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: IDEA: Comments Column Notes  (Read 7061 times)

mykemo

  • Participant
  • Joined in 2005
  • *
  • default avatar
  • Posts: 1
    • View Profile
    • Donate to Member
IDEA: Comments Column Notes
« on: December 05, 2005, 10:21 PM »
I have looked everywhere for a small utility app that lets users add comments to a folder so the comments appear in the "Comments" column of Windows Explorer.  I have a lot of folders and sub-folders.  Right now I am making the name of each folder really long to accurately describe the contents of the folder.  If the notes would appear in the "Comments" column, the folder names could be made much shorter and easier.  I can make the comments appear for files, but how about for the folder.  Please create a small utility app for adding, deleting and editing folder commets so they appear in the Windows Explorer screen.

lifeweaver

  • Member
  • Joined in 2014
  • **
  • Posts: 22
    • View Profile
    • Donate to Member
Re: IDEA: Comments Column Notes
« Reply #1 on: August 07, 2015, 02:47 PM »
This script with add/modify comments on folders via the Desktop.ini, to do this it makes the folder a system folder.
I couldn't figure out how to get explorer to reliably refresh but know that eventually the comments you choose will appear.

Use the script by installing AutoHotkey, double clicking on the script, and pressing alt + z.


;
; ==========================================================================================================
; Author               : LifeWeaver <[email protected]>
; Script Name        : SetFolderComments
; Script Version     :
; Homepage          :
;
; Creation Date      : 08/07/2015
; Modification Date :
;
; Description       : Lets you set comments on a folder via Desktop.ini
; ===================
;
; ----------------------------------------------------------------------------------------------------------

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance force

ActiveExplorerWindow()
{
  for window in ComObjCreate("Shell.Application").Windows
    if window.HWND = WinExist("A")
      return window
}

ExplorerItemsSelected(window)
{
  return window.Document.SelectedItems().count
}

SetFolderComments(folderPath, comments)
{
  desktopIniPath := folderPath . "\desktop.ini"
  ifExist %desktopIniPath%
  {
    ; desktop.ini file exists edit the InfoTip
    FileRead, desktopIniContents, %desktopIniPath%
  }
  else
  {
    ; set default desktop.ini contents
    desktopIniContents := "[.ShellClassInfo]`nInfoTip=`n"
  }
 
  FileDelete, %desktopIniPath%
  desktopIniContents := RegExReplace(desktopIniContents, "(?<=InfoTip=).*$", comments)
 
  FileAppend, %desktopIniContents%, %desktopIniPath%
  if(ErrorLevel)
  {
    msgbox problem(%A_LastError%) appending to %desktopIniPath%
  }
  else
  {
    ; Had issues with permission, running via hidden cmd
    Run, %comspec% /c attrib +S "%folderPath%" && attrib +H +S +A "%desktopIniPath%",,Hide
  }
 
  ; Update explorer
  DllCall( "Shell32\SHChangeNotify", UInt,0x08000000, UInt,0, Int,0, Int,0 ) ; SHCNE_ASSOCCHANGED
}

RemoveFolderComments(folderPath)
{
  IniDelete, %folderPath%, .ShellClassInfo, InfoTip
}

#IfWinActive
!z::
window := ActiveExplorerWindow()
InputBox, comment, Folder Comment, Enter folder(s) comment
; if an item(s) is/are selected set the comment on all files selected
if(ExplorerItemsSelected(window))
{
  for item in window.Document.SelectedItems()
    SetFolderComments(item.Path, comment)
}
else
{
  folderPath := window.Document.Folder.Self.path
  SetFolderComments(folderPath, comment)
}

return


Note: Autohotkey is need to run this script, although you could compile it and merely have an .exe.
Script runs on: Windows 7 Professional, AutoHotkey 1.1.15.04 Unicode build