Batya

|
Posted: Mon May 31, 2010 18:05 Post subject: |
|
|
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 |
|