Total Commander Forum Index Total Commander
Форум поддержки пользователей Total Commander
Сайты: Все о Total Commander | Totalcmd.net | Ghisler.com | RU.TCKB
 
 RulesRules   SearchSearch   FAQFAQ   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Single Post  Topic: Содержимое папки \Playlists (файлы *.m3u) в Playlists.bar 
Author Message
Batya



PostPosted: Thu Feb 11, 2010 21:07    Post subject: Reply with quote

vbs:
Code:
'===================================================================
' Создание панели TC, содержащей ссылки на m3u-файлы заданной папки
'===================================================================
Option Explicit
'========== Изменяемые параметры ===================================
Const FileExt  = "m3u" 'Расширение обрабатываемых файлов
Const FileIcon = "%SystemRoot%\system32\shell32.dll" 'Файл иконок
Const NumIcon  = 116 'Номер иконки в файле иконок
Const Folder   = "d:\Total Commander\SOFT\Winamp\Playlists\" 'Обрабатываемая папка
Const Bar      = "d:\Total Commander\BAR\Playlists.bar" 'Панель TC
'===================================================================
Dim FSO, WSH, F, Text, i
Set FSO = CreateObject("Scripting.FileSystemObject")
Set WSH = CreateObject("WScript.Shell")

i = 4
For Each F In FSO.GetFolder(GetPath(Folder)).Files
  If LCase(FSO.GetExtensionName(F.Path)) = LCase(FileExt) Then
    i = i + 1
    Text = Text & "button" & CStr(i) & "="  & FileIcon & "," & NumIcon & vbNewLine &_
                  "cmd"    & CStr(i) & "="  & F.Path                   & vbNewLine &_
                  "iconic" & CStr(i) & "=0"                            & vbNewLine &_
                  "menu"   & CStr(i) & "="  & FSO.GetBaseName(F.Path)  & vbNewLine
  End If
Next

Text = "[Buttonbar]"                                            & vbNewLine &_
       "Buttoncount=" & CStr(i)                                 & vbNewLine &_
       "button1=" & GetPath("%Commander_Path%\wcmicons.dll,15") & vbNewLine &_
       "cmd1="    & GetPath("%Commander_Path%\default.bar")     & vbNewLine &_
       "iconic1=0"                                              & vbNewLine &_
       "button2="                                               & vbNewLine &_
       "iconic2=0"                                              & vbNewLine &_
       "button3=" & GetPath("%Commander_Path%\wcmicons.dll")    & vbNewLine &_
       "cmd3="    & WScript.ScriptFullName                      & vbNewLine &_
       "iconic3=0"                                              & vbNewLine &_
       "menu3=Обновить"                                         & vbNewLine &_
       "button4="                                               & vbNewLine &_
       "iconic4=0"                                              & vbNewLine &_
       Text

FSO.OpenTextFile(GetPath(Bar), 2, True).Write Text

Set WSH = Nothing
Set FSO = Nothing
WScript.Quit 0

Function GetPath(pPath)
  GetPath = FSO.GetAbsolutePathName(WSH.ExpandEnvironmentStrings(pPath))
End Function

_________________
Нет, я не сплю. Я просто медленно моргаю.


Last edited by Batya on Fri Feb 12, 2010 14:36; edited 1 time in total
View user's profile Send private message


Powered by phpBB © 2001, 2005 phpBB Group