$filename(O:\TEST\BuildCat_BPM_2.vbs) '''===============================================================================================================' '''VBS Script proposal how to create a folder tree full of link files, which point to their physical dependancies.' '''The Mp3tag export feature creates and fills this VB script file with proper values.' '''Script version 2.1' '''(c)20100916.Detlev Dalitz.' '''===============================================================================================================' '''This is my personal root folder for now.' '''Note the trailing backslash.' 'My_Rootfolder = "O:\TEST\"' '''The user can choose one of the predefined system folders as the target root folder.' '''Simply remove the leading comment character to activate the wanted line.' '''My_Rootfolder = "Shell:CommonMusic"' '''Win Vista, XP.' '''My_Rootfolder = "Shell:My Music"' '''Win Vista, XP.' '''My_Rootfolder = "Shell:Desktop"' '''Win Vista, XP.' '''My_Rootfolder = "Shell:Personal"' '''Win Vista, XP.' '''My_Rootfolder = "Shell:SampleMusic"' '''Win Vista.' '''My_Rootfolder = "Shell:MusicLibrary"' '''Win 7.' '''My_Rootfolder = "Shell:OtherUsersFolder"' '''Win 7.' '''Create a Shell Application Object in order to display a "Browse For Folder Dialog".' 'Set objShellApp = WScript.CreateObject("Shell.Application")' 'BFF_RootFolder = My_Rootfolder' 'BFF_Title = "Choose an existing folder or create a new one ..."' 'BFF_STATUSTEXT = 4' 'BFF_EDITBOX = 16' 'BFF_VALIDATE = 32' 'BFF_Options = BFF_STATUSTEXT + BFF_EDITBOX + BFF_VALIDATE' 'Set objFolder = objShellApp.BrowseForFolder(0, BFF_Title, BFF_Options, BFF_RootFolder)' 'If (objFolder is Nothing) Then WScript.Quit 255' '''Set My_Rootfolder to the currently choosen location.' 'My_Rootfolder = objShellApp.NameSpace(objFolder).Self.Path & "\"' '''Destroy the Shell Application object.' 'Set objFolder = Nothing' 'Set objShellApp = Nothing' '''Create a Wscript Shell Object in order to communicate with the user.' 'Set objWShell = Wscript.CreateObject ("Wscript.Shell")' '''Give user the chance to abort.' 'strMsgTitle = "VBS Question"' 'strMsgText = "Create Foldertree and Linkfiles here?" & vbLf & """" & My_Rootfolder & """"' 'intSecondsToWait = 0' 'intButton = vbOKCancel + vbQuestion' 'intButtonCode = objWShell.Popup (strMsgText, intSecondsToWait, strMsgTitle, intButton)' 'Select Case intButtonCode' 'Case 2' 'Set objWShell = Nothing' 'WScript.Quit 255' 'End Select' '''On Error Resume Next' '''Do we need to activate this statement?' '''Let Mp3tag do some work.' $loop(%BPM%,1) 'Mp3tag_SubfolderNew = "'$if2('BPM '$num(%BPM%,3),'BPM 000')'\"' 'My_Folderpath = My_Rootfolder & Mp3tag_SubfolderNew' '''Create folder My_Folderpath.' 'strCmdLine = "CMD.EXE /C MD """ & My_Folderpath & """"' 'intWindowStyle = 0' '''Hides the window and activates another window.' 'blnWait = true' 'intResult = objWShell.Run (strCmdLine, intWindowStyle, blnWait)' 'strMsgTitle = "VBS Info"' 'strMsgText = "Folder created ..." & vbLf & """" & My_Folderpath & """"' 'intSecondsToWait = 1' 'intButton = vbOKOnly + vbInformation' 'intButtonCode = objWShell.Popup (strMsgText, intSecondsToWait, strMsgTitle, intButton)' $loop(%BPM%) 'Mp3tag_Path = "'%_path%'"' 'Mp3tag_Folderpath = "'%_folderpath%'"' 'Mp3tag_Filename_ext = "'%_filename_ext%'"' '''Create a WshShortcut Object.' 'Set objShellLink = objWShell.CreateShortcut (My_Folderpath & Mp3tag_Filename_ext & ".lnk")' '''Set the target filepath for the shortcut.' 'objShellLink.TargetPath = Mp3tag_Path' '''Set the additional parameters for the shortcut.' 'objShellLink.Arguments = ""' '''Set the working folder.' 'objShellLink.WorkingDirectory = Mp3tag_Folderpath' '''Save the shortcut.' 'objShellLink.Save' '''Destroy the WshShortcut Object.' 'Set objShellLink = Nothing' $loopend() $loopend() '''Display ready message.' 'strMsgTitle = "VBS Info"' 'strMsgText = "Foldertree and Links created in ..." & vbLf & """" & My_Rootfolder & """" & vbLf & vbLf & "Ready."' 'intSecondsToWait = 10' 'intButton = vbOKOnly + vbInformation' 'intButtonCode = objWShell.Popup (strMsgText, intSecondsToWait, strMsgTitle, intButton)' '''Open explorer window.' 'strCmdLine = "explorer.exe /e,/select,""" & My_Rootfolder & """"' 'intWindowStyle = 3' '''Activates the window and displays it as a maximized window.' 'blnWait = false' 'intResult = objWShell.Run (strCmdLine, intWindowStyle, blnWait)' '''Destroy the WShell Object.' 'Set objWShell = Nothing' 'WScript.Quit 0' '''End of VBS script.'