]> git.saurik.com Git - wxWidgets.git/blob - docs/mac/M8mcp2xml.applescript
cleanup
[wxWidgets.git] / docs / mac / M8mcp2xml.applescript
1 -----------------------------------------------------------------------------
2 -- Name: docs/mac/M8mcp2xml.applescript
3 -- Purpose: Automatic export of CodeWarrior 8 projects to XML files
4 -- Author: Gilles Depeyrot
5 -- Modified by: Stefan Csomor for M8
6 -- Created: 28.11.2001
7 -- RCS-ID: $Id$
8 -- Copyright: (c) 2001 Gilles Depeyrot
9 -- Licence: wxWindows licence
10 -----------------------------------------------------------------------------
11 --
12 -- This AppleScript automatically recurses through the selected folder looking for
13 -- and exporting CodeWarrior projects to xml files.
14 -- To use this script, simply open it with the 'Script Editor' and run it.
15 --
16
17 --
18 -- Suffix used to recognize CodeWarrior project files
19 --
20 property gProjectSuffix : "M8.mcp"
21
22 --
23 -- Project and build success count
24 --
25 set theProjectCount to 0
26 set theProjectSuccessCount to 0
27
28 --
29 -- Ask the user to select the wxWindows samples folder
30 --
31 set theFolder to choose folder with prompt "Select the wxWindows folder"
32
33 ExportProjects(theFolder)
34
35 tell me to display dialog "Exported " & theProjectSuccessCount & " projects out of " & theProjectCount
36
37 --
38 -- ExportProjects
39 --
40 on ExportProjects(inFolder)
41 global theProjectCount, theProjectSuccessCount
42
43 tell application "Finder" to update inFolder
44
45 try
46 tell application "Finder" to set theProject to ((the first file of inFolder whose name ends with gProjectSuffix) as string)
47 on error
48 set theProject to ""
49 end try
50
51 if theProject is not "" then
52 set theProjectCount to theProjectCount + 1
53
54 -- save the current text delimiters
55 set theDelimiters to my text item delimiters
56
57 -- replace the ".mcp" extension with ".xml"
58 set my text item delimiters to "."
59 set theList to (every text item of theProject)
60 set theList to (items 1 thru -2 of theList)
61 set theExport to (theList as string) & ".xml"
62
63 -- restore the text delimiters
64 set my text item delimiters to theDelimiters
65
66 tell application "CodeWarrior IDE"
67 --
68 -- Open the project in CodeWarrior
69 --
70 open theProject
71 --
72 -- Export the selected project
73 --
74 try
75 export project document 1 to theExport
76 set theProjectSuccessCount to theProjectSuccessCount + 1
77 on error number errnum
78 tell me to display dialog "Error " & errnum & " exporting " & theExport
79 end try
80 --
81 -- Close the project
82 --
83 Close Project
84 end tell
85 end if
86
87 tell application "Finder" to set theSubFolders to every folder of inFolder whose name does not end with " Data"
88 repeat with theFolder in theSubFolders
89 ExportProjects(theFolder)
90 end repeat
91
92 end ExportProjects