Here's 2 scripts that you need for media center PC's.
These files are for media center PC's in which the vid files are kept in the computers' HDD's.
First script takes the first 4 digits off of the system files that you've transferred to your PC. The script will remove the first 4 digits, and leave the files with shorter file names, still in sequence - 00, 01, 02, ...
Open Notepad, and copy and paste this script:
Now close and save: File/Save/ File name renamescript.bat Save as type All files , and put it on your desktop for convenience. To execute it, double click on the desktop icon. To open it for editing, rt click, and select 'edit'.Setlocal EnableDelayedExpansion
For %%A In ("W:\FolderName3" "W:\FolderName7") Do (
PushD "%%A"
For /F "Tokens=1 Delims=" %%I In ('dir /A-D /B ab10*.*') Do (
Set _tmp=%%I
Set _tmp=!_tmp:~4!
Ren "%%I" "!_tmp! "
)
PopD
)
Keys:
This script targets 2 folders targeted on W drive. The names are FolderName3 and FolderName7. Note there are no sub-folders. The drive does not necessarily need to be dedicated to media folders however.
ab10*.* means 2 things - 1) The first * (wildcard) means any file which starts with ab10 in its' filename, and ends with 00, 01, 02, ... as part of ITS' NAME, and the second * wildcard means a file that has ANY extension, like .doc , .jpg , .bmp , etc.
-------------------------------
This second script creates a file in MS Word, which is formatted as a table. Each 'cell' in the table will contain the title of the folder, and hyperlinks to each media file in the folder.
Words in red are user-specific variables, that you will change accordingly.
Open Notepad, copy and paste the text below, and then save and close - File Name = filename.vbs , Save as type = All Files (from drop-down menu), and save on your desktop for convenience.
As like the other script, to execute it, double click on the desktop icon. To open it for editing, rt click, and select 'edit'.strFirstDrive = "P" ... first drive that you're reading
strLastDrive = "P" ... last drive that you're reading
strSavePath = "C:\Users\You\Desktop\P_drive.docx" ... File name, and filepath of MS Word table.
Const ShowDoc = True
Const CloseDoc = True
Const NUMCOLS = 4 ... number of columns in table; I suggest 6 max.
Const NUMROWS = 24 ... no limit here - mine is up to 77 pages - I can't count the rows anymore
strComputer = "."
Set objFileSys = CreateObject("Scripting.FileSystemObject")
'' Create Word Doc and Create table.
Set objWord = CreateObject("Word.Application")
If ShowDoc = True Then
objWord.Visible = True
Else
objWord.Visible = False
End If
Set objDoc = objWord.Documents.Add()
Set objRange = objDoc.Range()
objRange.Collapse 0
Set objTable = objDoc.Tables.Add(objRange, NUMROWS, NUMCOLS)
objTable.Borders.Enable = true
CurCol = 0
CurRow = 1
'' Get list of hard drive
Set colDrives = objFileSys.Drives
'' Get Drive label and Root folder names
For Each objDrive in colDrives
strDriveLetter = UCase(objDrive.DriveLetter)
If (strDriveLetter >= strFirstDrive AND strDriveLetter <= strLastDrive) Then
If objDrive.IsReady = True Then
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colFolders = objWMIService.ExecQuery("Associators of {Win32_Directory.Name='" & strDriveLetter & ":'} Where AssocClass = Win32_Subdirectory")
'' Get files in each folder
For Each objFolder in colFolders
CurCol = CurCol + 1
If CurCol = NUMCOLS+1 Then
CurCol = 1
CurRow = CurRow +1
objTable.Rows.Add()
End If
Set objCell = objTable.Cell(CurRow, CurCol)
Set objCellRange = objCell.Range
objCell.Select
Set objSelection = objWord.Selection
objSelection.TypeText objDrive.VolumeName & " (" & strDriveLetter & ")" & Chr(11) & objFolder.FileName
objSelection.TypeParagraph()
objCellRange.Paragraphs.Add
Set objRange = objCellRange.Paragraphs(2).Range
Set colFiles = objWMIService.ExecQuery("Associators of {Win32_Directory.Name='" & objFolder.Name & "'} Where ResultClass = CIM_DataFile")
For Each objFile in colFiles
If objFile.Extension <> "ini" AND objFile.Extension <> "db" Then
Set objLink = objSelection.Hyperlinks.Add _
(objSelection.Range, "File:///" & objFile.Name, , , objFile.FileName)
objSelection.TypeText Chr(11)
End If
Next
Next
End If
End If
Next
objDoc.SaveAs "C:\Users\You\Desktop\P_Drive.docx" ... MUST BE THE SAME AS ABOVE!!!
If ShowDoc = False OR CloseDoc = True Then objWord.Quit
The text of each hyperlink will not actually be the title of the media file. There are 2 ways to have the title displayed as the actual hyperlink - one is to change each file name to the title BEFORE executing the MS Word-creation script (this means not using the first script I have posted). The second is after executing the MS Word-creation script, and changing the text of the hyperlink (this also means not using the renaming script).
The way I added titles to the MS Word document, was to add a 'cell' beside each cell with hyperlinks, and add the titles directly across from each hyperlink.
If you want to PayPal me some cash, PM me for my account address. Thanks...
+ Reply to Thread
Results 1 to 1 of 1
Similar Threads
-
Is there a way to see actions done by scripts?
By Marc01FR in forum ffmpegX general discussionReplies: 1Last Post: 21st Jan 2011, 14:27 -
Sticky threads
By stiltman in forum FeedbackReplies: 1Last Post: 27th Jan 2010, 23:49 -
I know I know its in the sticky but please indulge
By drathnal in forum DVD RippingReplies: 4Last Post: 22nd Oct 2009, 10:17 -
Are these scripts right?
By php111 in forum Newbie / General discussionsReplies: 7Last Post: 21st Jan 2008, 17:10 -
Scripts for Conversion
By jwfc in forum Newbie / General discussionsReplies: 2Last Post: 6th Nov 2007, 06:50