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