1'/************************************************************************* 2' 3' Licensed to the Apache Software Foundation (ASF) under one 4' or more contributor license agreements. See the NOTICE file 5' distributed with this work for additional information 6' regarding copyright ownership. The ASF licenses this file 7' to you under the Apache License, Version 2.0 (the 8' "License"); you may not use this file except in compliance 9' with the License. You may obtain a copy of the License at 10' 11' http://www.apache.org/licenses/LICENSE-2.0 12' 13' Unless required by applicable law or agreed to in writing, 14' software distributed under the License is distributed on an 15' "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16' KIND, either express or implied. See the License for the 17' specific language governing permissions and limitations 18' under the License. 19' 20' ************************************************************************/ 21'### Build Support Module for running commands to export and import 22'### modules from Word, Excel and PowerPoint Document Analysis driver documents 23 24 25<job id="DocAnalysisBuildCmd" error="true" debug="true"> 26 <script language="VBScript" src="DocAnalysisRunMacro.vbs"/> 27 <script language="VBScript"> 28 29Const CTITLE = "Document Analysis Command" 30 31Const CWORD_DRIVER = "_OOoDocAnalysisWordDriver.doc" 32Const CEXCEL_DRIVER = "_OOoDocAnalysisExcelDriver.xls" 33Const CPP_DRIVER = "_OOoDocAnalysisPPTDriver.ppt" 34Const CStub = "Stripped" 35 36Const CUTIL_APPNAME_WORD = "Word" 37Const CUTIL_APPNAME_EXCEL = "Excel" 38Const CUTIL_APPNAME_POWERPOINT = "Powerpoint" 39 40Const CDIAG_STD_DELAY = 2 41 42Const CDEFAULT_SOURCE_DIR = ".\sources\" 43Const CDEFAULT_TARGET_DIR = "." 44 45Const CSOURCE_DIR_ARG = "X" 46Const CTARGET_DIR_ARG = "T" 47Const CUSAGE_ARG = "?" 48 49Const CSTR_PAW = "\PAW\" 50 51'######### Doc Analysis Build - Main Script Body ############# 52Dim mArgsNamed, mArgsUnnamed 53Dim mSourceDir 54Dim mTargetDir 55 56On Error Resume Next 57 58'### Process Arguments ### 59Set mArgsNamed = WScript.Arguments.Named 60Set mArgsUnnamed = WScript.Arguments.Unnamed 61 62If mArgsNamed.Exists(CUSAGE_ARG) Then 63 Usage 64 FinalExit 65End If 66 67'# Source Dir 68if mArgsNamed.Exists(CSOURCE_DIR_ARG) Then 69 mSourceDir = mArgsNamed.Item(CSOURCE_DIR_ARG) 70Else 71 mSourceDir = CDEFAULT_SOURCE_DIR 72End If 73 74'# Target Dir 75if mArgsNamed.Exists(CTARGET_DIR_ARG ) Then 76 mTargetDir = mArgsNamed.Item(CTARGET_DIR_ARG ) 77Else 78 mTargetDir = CDEFAULT_TARGET_DIR 79End If 80 81mSourceDir = daFso.GetAbsolutePathName(mSourceDir ) 82mTargetDir = daFso.GetAbsolutePathName(mTargetDir ) 83 84'# Check source and target dirs exist 85If Not daFso.FolderExists(mSourceDir) Then 86 DAErrMsg "Source directory does not exist: " & mSourceDir, CDA_ERR_STD_DELAY 87 FinalExit 88End If 89If Not daFso.FolderExists(mTargetDir) Then 90 DAErrMsg "Target directory does not exist: " & mTargetDir, CDA_ERR_STD_DELAY 91 FinalExit 92End If 93 94Set mArgsNamed = Nothing 95Set mArgsUnnamed = Nothing 96 97'#### then continue with PAW 98ImportAll mTargetDir & CSTR_PAW 99 100'# Cleanup 101FinalExit 102 103 104'######### End - Main Script Body ############# 105 106 107'#### Doc Analysis Build - Support Functions #### 108 109Sub Usage() 110 DAdiagMsg "Build command line tool to create Document Analysis driver documents" & vbLf & vbLf &_ 111 "DocAnalysisBuildCmd [/X:<sourceDir>] [/T:<targetDir>]" & vbLf & vbLf &_ 112 "/X:<sourceDir> base <source> directory " & vbLf & _ 113 " The <sourceDir> is the base dir under which all the " & vbLf & _ 114 " _res.bas files are located to import from" & vbLf & vbLf & _ 115 "/T:<targetDir> target directory " & vbLf & _ 116 " <targetDir> is where the new Driver docs" & vbLf & _ 117 " will be created", 30 118End Sub 119 120'###################### 121Sub FinalExit() 122 DACleanUp 123 wscript.quit 124End Sub 125 126'###################### 127Sub ImportAll( aTargetDir ) 128 129 '#### Create automation servers #### 130 DAsetupWrdServer 131 DAsetupExcelServer 132 DAsetupPPServer 133 134 If Not daFso.FolderExists( aTargetDir ) Then 135 daFso.CreateFolder( aTargetDir ) 136 End If 137 138 BackupDrivers aTargetDir 139 140 DAOpenWrdDriver mSourceDir & "\" & CSTUB & CWORD_DRIVER 141 DAOpenExcelDriver mSourceDir & "\" & CSTUB & CEXCEL_DRIVER 142 DAOpenPPDriver mSourceDir & "\" & CSTUB & CPP_DRIVER 143 144 DASetTitle CTITLE & " - Import" 145 146 ImportSelectedProjectFiles mSourceDir, CUTIL_APPNAME_WORD 147 ImportSelectedProjectFiles mSourceDir, CUTIL_APPNAME_EXCEL 148 ImportSelectedProjectFiles mSourceDir, CUTIL_APPNAME_POWERPOINT 149 150 DAsaveWrdDriver aTargetDir & "\" & CWORD_DRIVER 151 DAsaveExcelDriver aTargetDir & "\" & CEXCEL_DRIVER 152 DAsavePPDriver aTargetDir & "\" & CPP_DRIVER 153 154 DACloseApps 155End Sub 156 157'###################### 158Sub BackupDrivers(importdir) 159 On Error Resume Next 160 161 Dim wrdPath 162 Dim xlsPath 163 Dim ppPath 164 165 wrdPath = daFso.GetAbsolutePathName(importdir & "\" & CWORD_DRIVER) 166 xlsPath= daFso.GetAbsolutePathName(importdir & "\" & CEXCEL_DRIVER) 167 ppPath= daFso.GetAbsolutePathName(importdir & "\" & CPP_DRIVER) 168 169 If daFso.FileExists( wrdPath ) Then daFso.CopyFile wrdPath, wrdPath & ".bak" 170 If daFso.FileExists( xlsPath ) Then daFso.CopyFile xlsPath, xlsPath & ".bak" 171 If daFso.FileExists( ppPath ) Then daFso.CopyFile ppPath, ppPath & ".bak" 172End Sub 173 174'###################### 175Sub ImportSelectedProjectFiles(dir, app_name) 176 On Error Resume Next 177 178 Dim base 179 Dim lcApp_name 180 lcApp_name = LCase(app_name) 181 182 'Driver Specific 183 base = dir & "\" & lcApp_name & "\" 184 185 DAImportFile base & "ApplicationSpecific.bas", "ApplicationSpecific", app_name 186 DAImportFile base & "MigrationAnalyser.cls", "MigrationAnalyser", app_name 187 188 DAImportFile base & "Preparation.bas", "Preparation", app_name 189 190 'app resource 191 DAImportFile base & lcApp_name & "_res.bas", lcApp_name & "_res", app_name 192 193 'Common 194 base = dir & "\" 195 DAImportFile base & "AnalysisDriver.bas", "AnalysisDriver", app_name 196 DAImportFile base & "CommonMigrationAnalyser.bas", "CommonMigrationAnalyser", app_name 197 DAImportFile base & "CollectedFiles.cls", "CollectedFiles", app_name 198 DAImportFile base & "DocumentAnalysis.cls", "DocumentAnalysis", app_name 199 DAImportFile base & "FileTypeAssociation.cls", "FileTypeAssociation", app_name 200 DAImportFile base & "IssueInfo.cls", "IssueInfo", app_name 201 DAImportFile base & "PrepareInfo.cls", "PrepareInfo", app_name 202 DAImportFile base & "StringDataManager.cls", "StringDataManager", app_name 203 DAImportFile base & "LocalizeResults.bas", "LocalizeResults", app_name 204 205 DAImportFile base & "CommonPreparation.bas", "CommonPreparation", app_name 206 207 'common resource 208 DAImportFile base & "common_res.bas", "common_res", app_name 209 DAImportFile base & "results_res.bas", "results_res", app_name 210 211End Sub 212 213</script> 214</job> 215 216