Monday, January 12, 2009

Removing duplicate itunes files

This is a quick script I modified from here that moves duplicate iTunes files so you can review them before deleting them. Get the full description of how to remove files from iTunes from here.

To run the script copy the text to a new file and go to a command prompt and type:

cscript SAVED_FILENAME
example: cscript movefiles.vbs
---------script below---------------------


Set objFSO = Wscript.CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\Users\Public\Music\iTunes")
Set colSubFolders = objFolder.Subfolders
newBaseDir = "C:\removed\" 'top level path for folders/files to be moved into

'get inside each artist's folder
For Each objSubFolder in colSubFolders
'Wscript.Echo objSubFolder.Name
'once inside the folder do the following...
Set colSubSubFolders = objSubFolder.Subfolders
'Get inside each album folder
For Each objSubSubFolder in colSubSubFolders
'once inside do the following
'WScript.Echo vbtab & objSubSubFolder.name
Set colMP3Files = objSubSubFolder.Files
For Each objMP3File in colMP3Files
'Wscript.Echo vbtab & objMP3File.Name
strCurrentMP3Name = objMP3File.Name
For Each objMP3File2 in colMP3Files
'Wscript.Echo Left(strCurrentMP3Name, Len(strCurrentMP3Name)-4) & vbtab & Left(objMP3File2.Name, Len(objMP3File2.Name)-6)
If UCase(Left(strCurrentMP3Name, Len(strCurrentMP3Name)-4)) = UCase(Left(objMP3File2.Name, Len(objMP3File2.Name)-6)) Then
origDir = objMP3File2.Path & "\"
newDir = newBaseDir & objSubFolder.name & "\" & objSubSubFolder.name
newFile = newDir & "\" & objMP3File2.Name
Wscript.Echo("base file: " & UCase(strCurrentMp3Name & vbtab & vbtab & vbtab & "deleting file: " & objMP3File2.Name))
'Wscript.Echo vbtab & objMP3File2.Path
If Not objFSO.FolderExists(newDir) Then
WScript.echo vbtab & "creating folder: " & newDir
CreateFolder( newDir )
End If
WScript.Echo vbtab & "...done " & objMP3File2.Path & " newFile: " & newDir

objFSO.moveFile objMP3File2.Path, newFile
End If
Next
Next
Next
Next


'Recursive folder create, will create directories and Sub
Sub CreateFolder( strPath )
Dim objFSO1
Set objFSO1 = CreateObject("Scripting.FileSystemObject")
On Error Resume Next
If strPath <> "" Then
If Not objFSO1.FolderExists( objFSO1.GetParentFolderName(strPath) ) then Call CreateFolder( objFSO1.GetParentFolderName(strPath) )
objFSO1.CreateFolder( strPath )
End If
End Sub



==========================================
This posting is provided "AS IS" with no warranties.

Sunday, March 30, 2008

Customizing Deltek Vision - Project Descriptions

If you are a user of Deltek Vision v5.0 you will find that there are some customizations you can do to make Deltek more useful to users. It is important to note that these types of customizations are unsupported by Deltek and should be done in a test/lab environment before making any changes to your production databases. This post assumes you are using Deltek Vision 5.0 on the Windows Server 2003 platform and using Microsoft SQL Server 2005 as the database backend.

Project descriptions are a key component of Deltek as they give the user the ability to categorize project descriptions for use in resumes, proposals, etc. However, it would be helpful if it showed the Modified by user, date, and allowed for customized notes, see below:



To make these changes you will need to modify the application javascript as well as the underlying database table. First, update the table to add the notes column

update table PRDescriptions add column Notes as varchar(MAX)
update table PRDescriptionsTemplate add column Notes as varchar(MAX)


Now in order to update the javascript, you will need to locate the ProjectInfoCenter.js file in your application directory. On my system it is in the c:/Program Files/Deltek/Vision/Web/js directory.

Open the file and look for the following lines:
tmpObj = gridDescr.addHtmlEditColumn("PRDESC.Description", "Description", "string");
tmpObj.width = 320;
tmpObj.displayOnly = true;

Add the following lines:
tmpObj = gridDescr.addHtmlHrefColumn("PRDESC.ModUser AS desModUser", "ModUser", "string:50", "Description");
tmpObj.updateable = false;
tmpObj.displayOnly = true;
tmpObj.width = 50;
tmpObj = gridDescr.addHtmlHrefColumn("PRDESC.ModDate AS desModDate", "ModDate", "string:50", "Description");
tmpObj.updateable = false;
tmpObj.displayOnly = true;
tmpObj.width = 50;
tmpObj = gridDescr.addHtmlEditColumn("PRDESC.Notes", "Notes", "string");
tmpObj.width = 120;
tmpObj.displayOnly = true;

Save the file and reset IIS. Open Deltek and take a look.

Purpose of the blog

This blog will attempt to help developers of various applications find ways to make them more functional and user friendly.

Enjoy