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: Свои иконки у папок 
Author Message
Batya



PostPosted: Mon Apr 24, 2006 18:13    Post subject: Reply with quote

Немного изменил скрипт. Теперь его также можно запускать с параметрами %P%N %T%M. В этом случае для папки, на которой стоит курсор, будет создан Desktop.ini с указанием на файл иконок, который является текущим на противоположной панели:
Code:
'============================
' Создание файла Desktop.ini

' Параметры вызова из TC:
' "%P" "%N"
' или:
' %P%N %T%M
'============================

Dim FSO, TargetDir, IconFile, FileName, oDir, Attr, oFile, MB
Set FSO = CreateObject("Scripting.FileSystemObject")

TargetDir = WScript.Arguments(0)
IconFile  = WScript.Arguments(1)
FileName  = "Desktop.ini"

If FSO.FolderExists(TargetDir)Then
  If Right(TargetDir, 1) <> "\" Then
    TargetDir = TargetDir & "\"
  End If
Else
  MB = MsgBox("Не задано имя папки!", vbOKOnly + vbExclamation, "Создание Desktop.ini")
  WScript.Quit
End If
' Установим для папки атрибут "Только чтение"
Attr = 1
Set oDir  = FSO.GetFolder(TargetDir)
oDir.Attributes = oDir.Attributes or Attr

'Создадим Desktop.ini
If not FSO.FileExists(TargetDir & FileName) Then
  Set oFile  = FSO.CreateTextFile(TargetDir & FileName)
  oFile.WriteLine "[.ShellClassInfo]"
  oFile.WriteLine "IconFile=" & IconFile
  oFile.WriteLine "IconIndex=0"
  oFile.Close
  ' Установим для файла атрибуты "Скрытый", "Системный", "Архивный"
  Attr = 38
  Set oFile = FSO.GetFile(TargetDir & FileName)
  oFile.Attributes = oFile.Attributes or Attr
End If

Set FSO   = Nothing
Set oDir  = Nothing
Set oFile = Nothing
WScript.Quit


Last edited by Batya on Wed May 17, 2006 13:25; edited 1 time in total
View user's profile Send private message


Powered by phpBB © 2001, 2005 phpBB Group