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
Volniy



PostPosted: Thu Jan 10, 2008 18:22    Post subject: Reply with quote

Lari wrote:
НО еще плюс к этому нужно зайти в эту папку.


Пробуй такой вариант (исправлено на основе идеи Batya)

Code:
'=========================[ Start of file ]=========================
Option Explicit

Dim CurPath, NewFolder, CurFile, FileName, NPath, TempFile, SelFile
Dim WSH, FSO
Set WSH = CreateObject ("Wscript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")

CurPath = WScript.Arguments(0)   '"%P"
NewFolder = WScript.Arguments(1) '"%O"
CurFile = WScript.Arguments(2)   '"%L"
FileName = WScript.Arguments(3)  '"%N"

If UCase(NewFolder) = UCase(FileName) Then
   WScript.Quit()
End If

NPath = CurPath & NewFolder

If Not FSO.FolderExists(NPath) Then
   FSO.CreateFolder NPath
End If

If FSO.FolderExists(NPath) Then
  Set TempFile = FSO.OpenTextFile(CurFile, 1)
   Do While Not TempFile.AtEndOfStream
     Set SelFile = FSO.GetFile(TempFile.ReadLine)
     If Not FSO.FileExists (NPath & "\" & SelFile.Name) Then
        FSO.MoveFile SelFile.Path , NPath & "\" & SelFile.Name
     End If
  Loop
  WSH.Run """" & "%COMMANDER_PATH%\totalcmd.exe""" _
          & " /O /S /L=""" & NPath & """", 8, False
End If


WScript.Quit()
'=========================[  End of file  ]=========================


Last edited by Volniy on Thu Jan 10, 2008 22:36; edited 1 time in total
View user's profile Send private message


Powered by phpBB © 2001, 2005 phpBB Group