Sub TestRunMacro(TCSActiveModule, TCSExecutionParams)' do somethingEnd sub IExecutionParams = interface(IModule) ['{35290570-1196-4981-BB36-1055B58741C6}'] property ReturnCode: Integer read|write; property ReturnMessage: String read|write; property DocExecutionParams: IDocExecutionParams read; end;IDocExecutionParams = interface(IModule) ['{A95D7620-9CBB-48F8-B872-2FDF487AD873}'] property ActiveFileNamePath: String read; property FileList: ICSDNStrings read; property DocVerID: Integer read; property DocTypeNote: String read; property CurrentEvent: EnumDocExecutionEvent read; property CmdID: integer read; property CmdClass: integer read; end;EnumDocExecutionEvent отображает текущее событие при котором выполняется макрос
type EnumDocExecutionEvent = TOleEnum;const dceBeforeUnload = $00000001 dceAfterUnload = $00000002 dceBeforeLoad = $00000003 dceAfterLoad = $00000004Стадия выполнения макроса
Sub TestMacro(TCSActiveModule, TCSExecutionParams) Set Event = TCSExecutionParams.DocExecutionParams.EnumDocExecutionEvent Select case Event case dceBeforeUnload ' Код который необходимо выполнить до выгрузки файлового состава case dceAfterLoad ' Код который необходимо выполнить перед обновлением файлового ' состава case Else ' Другие события не обрабатываем, поэтому ReturnCode = 0TCSExecutionParams.ReturnCode = 0
End Select...End SubВыполнение макроса при выгрузке файлового состава
( CurrentEvent = dceBeforeUnload ReturnCode = -1 ReturnMessage = "" ActiveFileNamePath = <полный путь к файлу над которым выполняется команда> DocVerID = <версия документа> DocTypeNote = <вид документа> FileList = "" CmdID = <Id команды> CmdClass = <класс команды> ) ( CurrentEvent = dceAfterUnload ReturnCode = -1 ReturnMessage = "" ActiveFileName = <полный путь к файлу над которым выполняется команда> DocVerID = <версия документа> DocTypeNote = <вид документа> FileList = <список выгруженных файлов> CmdID = <Id команды> CmdClass = <класс команды> )Выполнение макроса при обновлении файлового состава
(CurrentEvent = dceBeforeLoad
ReturnCode = -1
ReturnMessage = "" ActiveFileName = ""DocVerID = <версия документа>
DocTypeNote = <вид документа>
FileList = ""CmdID = <Id команды>
CmdClass = <класс команды> )(
CurrentEvent = dceAfterLoad ReturnCode = -1 ReturnMessage = "" ActiveFileName = "" DocVerID = <версия документа> DocTypeNote = <вид документа> FileList = "" CmdID = <Id команды> CmdClass = <класс команды> )
! См. также: