|
Each contribution is licensed to you under a License Agreement by its owner, not Microsoft. Microsoft does not guarantee the contribution or purport to grant rights to it.
|
Categories |
Add Summary Information to a File(Community)
Script Code
VBScript
'Script name: addcomment.vbs
'Created on: Thursday, April 19, 2007
'Author: Ketan Kothari
'Purpose: Add Comments to Files. You can enable the comment column, by right clicking on Name Field
'on the top grey bar and select comment. Tested on Windows XP
'You will also need to down load Microsoft Developer Support OLE File Property Reader 2.0 Sample
'(KB 224351) DsoFileSetup_KB224351_x86.exe for this.
'Download link: http://www.microsoft.com/downloads/details.aspx?FamilyID=9ba6fac6-520b-4a0a-878a-53ec8300c4c2&DisplayLang=en 'or search for DSOFile.
'Also you can add this script to right click context menu for any file as follows.
'Go to HKEY_CLASSES_ROOT
'Create shell Key if it does not exists
'Create a Key Add Comment under Shell Key
'Create a Key Command under Add Comment
'Set default value as follows for Command key.
'wscript.exe C:\scripts\addcomment.vbs "%1"
'Issues with this script: For Non Microsoft office file, if you are adding the comment for the first time,
'it does not work and gives error message Permission denied. You need to add the comment
'first time yourself by selecting properties and adding the comment. It works fine after that.
'This is not a issue with microsoft office files.
'The details are at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=160868&SiteID=1
'Information about DSofile.dll is at http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q224351
'-----------------------------------------------------------------
'Remember to replace scripts with your folder name. Now you can right click on any file and add, modify or delete the
'comments. This is a great way to add additional information about an existing file.
'This file allows you to add comment to any file.
if wscript.Arguments.count > 0 then
doc = wscript.Arguments(0)
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FileExists (doc)) Then
Set objFile = CreateObject("DSOFile.OleDocumentProperties")
objfile.open(doc)
current_comment = objfile.SummaryProperties.comments
comment = InputBox("Enter Comment",doc,current_comment)
'User Enters the Cancel Button
if TypeName(comment) = "Empty" Then
Wscript.Quit
else
if comment <> current_comment then
objfile.SummaryProperties.comments = comment
objfile.save
end if
end if
else
MsgBox "File does not exists",vbOKOnly,doc
end if
else
MsgBox "No Filename provided",vbOKOnly
end if
Platforms
For online peer support, join
The Official Scripting Guys Forum!
To provide feedback or report bugs in sample scripts, please start a new discussion on the Discussions tab for this script.
Disclaimer
The sample scripts are not supported under any Microsoft standard support program or service. The sample scripts are provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.
Be the first to create a discussion.
|