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 May 31, 2010 18:05    Post subject: Reply with quote

AVos002
vbs-скрипт:
Code:
'==============================================================
' Открытие нового сообщния MS Outlook с вложенным файлом
'
' Параметры:
' {путь к MS Outlook} {файл}
'
' Пример параметров при вызове из TC:
' "%%ProgramFiles%%\Microsoft Office\Office11\Outlook.exe" %P%N
'==============================================================
Option Explicit
Dim FSO, WSH, TCS, MSOutlook, File, Comment
Set FSO = CreateObject("Scripting.FileSystemObject")
Set WSH = CreateObject("WScript.Shell")

MSOutlook = GetPath(WScript.Arguments(0))
File      = GetPath(WScript.Arguments(1))
Comment   = GetComment(File)
If Comment <> "" Then Comment = " " & Comment

CreateObject("TCScript.Helper").SetTextToClip FSO.GetFileName(File) & Comment

WSH.Run """" & MSOutlook & """ /a """ & File & """", 1, False

Set WSH = Nothing
Set FSO = Nothing
WScript.Quit

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

Function GetComment(pPath)
  Const CommFile = "descript.ion"
  Dim lPath, lName, lText, lComm
  lPath = FSO.GetParentFolderName(pPath)
  lName = FSO.GetFile(pPath).Name
  If Instr(lName, " ") > 0 Then lName = """" & lName & """"
  If lPath <> "" Then lPath = lPath & "\"
  If FSO.FileExists(lPath & CommFile) Then
    lText = FSO.OpenTextFile(lPath & CommFile).ReadAll
    lComm = Filter(Split(lText, vbNewLine), lName & " ", True, 1)
    If UBound(lComm) > - 1 Then
      GetComment = Replace(Mid(lComm(0), Len(lName) + 2), "В", "")
      GetComment = Trim(Replace(GetComment, "\n", " "))
    Else
      GetComment = ""
    End If
  Else
    GetComment = ""
  End If
End Function

В скрипте используется Script Helper.
_________________
Нет, я не сплю. Я просто медленно моргаю.


Last edited by Batya on Wed Jun 02, 2010 00:06; edited 4 times in total
View user's profile Send private message


Powered by phpBB © 2001, 2005 phpBB Group