]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/mac/M5mcp2xml.applescript
added AppleScripts to export/import xml files from/to projects
[wxWidgets.git] / docs / mac / M5mcp2xml.applescript
... / ...
CommitLineData
1-----------------------------------------------------------------------------
2-- Name: docs/mac/M5mcp2xml.applescript
3-- Purpose: Automatic export of CodeWarrior 5 projects to XML files
4-- Author: Gilles Depeyrot
5-- Modified by:
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--
20property gProjectSuffix : "M5.mcp"
21
22--
23-- Project and build success count
24--
25set theProjectCount to 0
26set theProjectSuccessCount to 0
27
28--
29-- Ask the user to select the wxWindows samples folder
30--
31set theFolder to choose folder with prompt "Select the wxWindows folder"
32
33ExportProjects(theFolder)
34
35tell me to display dialog "Exported " & theProjectSuccessCount & " projects out of " & theProjectCount
36
37--
38-- ExportProjects
39--
40on ExportProjects(inFolder)
41 global theProjectCount, theProjectSuccessCount
42
43 try
44 tell application "Finder" to set theProject to ((the first file of inFolder whose name ends with gProjectSuffix) as string)
45 on error
46 set theProject to ""
47 end try
48
49 if theProject is not "" then
50 set theProjectCount to theProjectCount + 1
51
52 -- save the current text delimiters
53 set theDelimiters to my text item delimiters
54
55 -- replace the ".mcp" extension with ".xml"
56 set my text item delimiters to "."
57 set theList to (every text item of theProject)
58 set theList to (items 1 thru -2 of theList)
59 set theExport to (theList as string) & ".xml"
60
61 -- restore the text delimiters
62 set my text item delimiters to theDelimiters
63
64 tell application "CodeWarrior IDE 4.0.4"
65 --
66 -- Open the project in CodeWarrior
67 --
68 open theProject
69 --
70 -- Export the selected project
71 --
72 try
73 export project document 1 in theExport
74 set theProjectSuccessCount to theProjectSuccessCount + 1
75 on error number errnum
76 tell me to display dialog "Error " & errnum & " exporting " & theExport
77 end try
78 --
79 -- Close the project
80 --
81 Close Project
82 end tell
83 end if
84
85 tell application "Finder" to set theSubFolders to every folder of inFolder
86 repeat with theFolder in theSubFolders
87 ExportProjects(theFolder)
88 end repeat
89
90end ExportProjects