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: Действие параметров %P%S не соответствует справке? 
Author Message
Flasher



PostPosted: Tue Nov 15, 2011 23:03    Post subject: Reply with quote

Flasher wrote:
Верней, есть один вариант, но непортабельный - с помощью Хелпера.
Так, смеху ради (хотя, может, кого и устроит):
Code:
'=================================================================
' Открывать файлы, если они выделены,
' иначе открывать редактор без переданных параметров

' Необходима регистрация Script Helper ActiveX for TC

' Параметры: "<Путь к редактору>" %P%N %P%S
' Пример: "%%COMMANDER_PATH%%\Utils\AkelPad\AkelPad.exe" %P%N %P%S
'=================================================================
With WScript.Arguments
  C = .Count
  If C = 0 Then WScript.Quit
  Ed = .Item(0)
  P1 = .Item(1)
  P2 = .Item(2)
End With

Dim WSH
Set WSH = CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
If C = 3 And P1 = P2 Then
  If FSO.FileExists(P2)) Then
    With CreateObject("TCScript.Helper")
      .LockTC True
      .SendCommand(525)
      N1 = .GetSrcSelectedFiles(0)(0)
      .SendCommand(525)
      N2 = .GetSrcSelectedFiles(0)(0)
      .LockTC False
    End With
    If N1 <> N2 Then WSH.Exec Ed
  Else  WSH.Exec Ed
  End If
  Quit
End If
For i = 2 to C - 1
  Par = WScript.Arguments(i)
  If FSO.FileExists(Par) Then Pars = Pars & " """ & Par & """"
Next
WSH.Exec Ed & " " & Pars
Quit

Sub Quit
  Set WSH = Nothing
  Set FSO = Nothing
  WScript.Quit
End Sub
+ Пару перестановок.

Last edited by Flasher on Wed Nov 16, 2011 02:40; edited 1 time in total
View user's profile Send private message


Powered by phpBB © 2001, 2005 phpBB Group