XML Script

From OCAD 12 Wiki - English
Revision as of 15:50, 29 November 2011 by 80.238.133.235 (talk) (Shape)

Jump to: navigation, search

(This function is only available in OCAD Professional!)

Choose this command to execute functions whose settings are defined in a XML file.


Introduction

Select Execute XML Script from File menu.


XML Script General

File

Node <OcadScript> Parameter Data type Values / Description
File.Open File String ocd file name
File.Close Enable Boolean true, false
File.Save Enable Boolean true, false
File.SaveAs File String ocd file name
File.MultipleFileImport Directory
CoordinateSystem
NewOffset
Horizontally
Vertically
Angle
MapScale
GridDistance
LayerField
String
Integer
Boolean
Integer
Integer
Double
Integer
Double
String
Directory of import files
-1 = WGS 84, 1000 = existing grid
true, false
 
 
 
 
 
 
File.ExportOIM File String html file name
File.Exit Enabled Boolean true, false Close OCAD Program

View

Node <OcadScript> Parameter Data type Values / Description
View.EntireMap Enable Boolean true, false
View.MoveTo X
Y
Double
Double
 

Map

Node <OcadScript> Parameter Data type Values / Description
Map. OptimizeRepair Enable Boolean true, false
Map.ChangeScale NewScale Integer e. g. 10 000
  EnlargeReduceSymbols Boolean true, false
Map.ConvertLayer CrtFile String crt file name
Symbol.LoadSymbolsFrom File String ocd file name (with symbols to be loaded)
The option replace existing colors and symbols is used


Database

Node <OcadScript> Parameter Data type Values / Description
Database.Dataset.Remove Dataset String
Integer
all for all databases
3, 2, 1, ... for only one or several
Database.Assign.Symbols Dataset
 
CntFile
String
Integer
String
all for all databases
1, 2, 3, ... for only one database
 
ex. 101.0
true, false (Default)
Database.Assign.Texts Dataset
 
TextField
Symbol
ReplaceExistingObjects
String
Integer
String
String
Boolean
all for all databases
1, 2, 3, ... for only one database
 
ex. 101.0
true, false (Default)
Database.Assign.Angles Dataset
 
AngleField
String
Integer
String
all for all databases
1, 2, 3, ... for only one database
 
Database.CreateObjects Dataset
SelectSymbol
Condition
HorizontalCoordinate
VerticalCoordinate
Unit
TextField
HorizontalOffset
VerticalOffset
Integer
Double
String
String
String
Enum. types
String
Double
Double
1, 2, 3, ... Number of dataset
Symbol numer. ex. 207,0
SQL String (ex. SYMBOL LIKE 207,0)
Database fieldname
Database fieldname
m, km
Database fieldname
 
 


Example xml file:

<OcadScript>
 <File.Open>
   <File>C:\Albis\albis_leer.ocd</File>
</File.Open>
<File.MultipleFileImport>
   <Directory>C:\Albis\shp</Directory>
  <NewOffset>enabled</NewOffset>
  <Horizontally>670000</Horizontally>
  <Vertically>230000</Vertically>
  <Angle>20</Angle>
  <MapScale>20000</MapScale>
  <GridDistance>500</GridDistance>
   <LayerField>OBJECTVAL/LayerField>
</File.MultipleFileImport>
 <Database.Assign.Texts>
  <Dataset>all</Dataset>
   <TextField>ID</TextField>
   <Symbol>101.0</Symbol>
   <ReplaceExistingObjects>true</ReplaceExistingObjects >
 </Database.Assign.Texts>
<Database.Assign.Angles>
  <Dataset>all</Dataset>  
   <AngleField>ID</AngleField>
</Database.Assign.Angles>
 
<Database.Assign.Symbols>
  <Dataset>all</Dataset>
  <CntFile>C:\Albis\cnt\Landeskarte.cnt</CntFile>
</Database.Assign.Symbols>
 <Database.Dataset.Remove>
  <Dataset>all</Dataset>
</Database.Dataset.Remove>
 <Map.OptimizeRepair>
<Enabled>true</Enabled>
 </Map.OptimizeRepair>
 <View.EntireMap>
 <Enabled>true</Enabled>
</View.EntireMap>
<File.Save>
  <Enabled>false</Enabled>
</File.Save>
 <File.SaveAs>
  <File>C:\Albis\Albis2.ocd</File>
 </File.SaveAs>
 <File.Close>
  <Enabled>true</Enabled>
</File.Close>
 <File.Exit>
  <Enabled>false</Enabled>
 </File.Exit>
</OcadScript>

XML Script Partial Map

Node <OcadScript> Parameter Data type Values / Description
export file String eg.: ‚ c:\export\PartialMap1.ocd ‘
OCAD creates files PartialMap1_1_1.ocd,
PartialMap1_1_2.ocd,
export coordSystem Enumerated types mm (paper), m (real world)
export T, L, B, R Float top, left, bottom, right
export.loop enabled
horizontalPages
verticalpages
horizontalOverlap
verticalOverlap
Bool
Integer
Integer
Float
Float
true, false
number of pages in horizontal direction
number of pages in vertical direction
horizontal overlap in mm or m
vertical overlap in mm or m


Example xml file:

<ocadScript>                                               // comment   
<partialMapScript>
   <export id="0">                                         // first export section
    <file>c:\export\PartialMap1.ocd</file>                 // export file
    <coordSystem>mm</coordSystem>                          // paper oder real world coordinates
    <T>100</T>                                             // export rectangle with Top Left point and Bottom Right point 
    <L>0</L>
    <B>50</B>
    <R>50</R>
      <loop>                                               // the loop export several ocd files. For this example 21 files.
      <enabled>true</enabled>
      <horizontalPages>7</horizontalPages>              
      <verticalPages>3</verticalPages>
      <horizontalOverlap>10</horizontalOverlap>            // horizontal and vertical overlap. 
      <verticalOverlap>10</verticalOverlap>
    </loop>
    </export>                                              // second export section
    <export id="1">
    <file>c:\export\PartialMap2.ocd</file>
    <coordSystem>mm</coordSystem>
    <L>0</L>
    <R>50</R>
    <B>50</B>
    <T>100</T>
      <loop>
      <enabled>false</enabled>
    </loop>                                                // export only one ocd file
    </export>
  </partialMapScript>
</ocadScript>

XML Script Print

Print parameters can be saved in a XML script.

Node <OcadScript> Parameter Data type Values / Description
File.Print.Printer Name
DmPaperSize
DmDefaultSource
DmPrintQuality
DmColor
DmMediaType
String
Integer
Integer
Integer
Integer
Integer
Eg. ,HP Color LaserJet 2840 PCL'
9
15
600
2
272
File.Print.Portrait Enable Bool true, false
File.Print.SpotColor Enable Bool true, false
FilePrint.PartialMap Range
L, R, B, T
Integer
Float
1
Left, Right, Bottom, Top
File.Print.HoizontalOverlap   Float -12,74
File.Print.VerticalOverlap   Float 8.74
File.Print.PrintScale   Integer Eg. 25000
File.Print.Copies   Integer Number of copies
File.Print.Intensity   Integer  
File.Print.LineWidth   Integer  
File.Print.PrintGrid Enabled Bool true, false

XML Script Export

AI (Adobe Illustrator), PDF

Node <OcadScript> Parameter Data type Values / Description
export file String eg.: ,c::\Export\Chlosterwald.ai‘
export format Enumerated types AI, PDF
export.partialMap enabled
coordSystem
 
L, R, B, T
 
Bool
Enumerated types
 
Float
 
true, false
mm (page), m (real world)
[only if partialMap=enabled]
left, right, bottom, top
[only if partialMap=enable]
export print Scale Integer  
export colors Enumerated types normal, spotColors
export combine Bool true, false [only if color = spotColors]
export.spotColors enabled Spotcolor name [only if color = spotColors]


BMP, GIF, JPEG

Node <OcadScript> Parameter Data type Values / Description
export file String eg.: ‚c:\Export\Chlosterwald.bmp‘
export format Enumerated types BMP, GIF, JPEG
export resolution Integer  
export anti-alias Bool true, false
export colorCorrection Bool true, false
export.partialMap enabled
coordSystem
 
L, R, B, T
 
Bool
Enumerated types
 
Float
 
true, false
mm (paper), m (real world)
[only if partialmap=enable]
left, right, bottom, top
[only if patialmap=enable]
export.tiles enabled
width
height
Bool
Integer
Integer
true, false
[only if enabled = true]
[only if enabled = true]


EPS

Node <OcadScript> Parameter Data type Values / Description
export file String eg.: ‚c:\Export\Chlosterwald.eps ‘
export format Enumerated types EPS
export.partialMap enabled
coordSystem
 
L, R, B, T
 
Bool
Enumerated types
 
Float
 
true, false
mm (paper), m (real world)
[only if partialMap=enable]
left, right, bottom ,top
[only if partialMap=enable]
export printScale Integer  
export colors Enumerated types normal, spotColors
export.spotColors enabled Spotcolor name [only if colors = spotColors]


SVG (Scaleable Vector Graphics)

Node <OcadScript> Parameter Data type Values / Description
export file String eg.: ‚c:\Export\Chlosterwald.svg ‘
export format Enumerated types SVG
export.partialMap enabled
coordSystem
 
L, R, B, T
 
Bool
Enumerated types
 
Float
 
true, false
mm (paper), m (real world)
[only if partialMap=enable]
left, right, bottom ,top
[only if partialMap=enable]
export printScale Integer  
export compressFile Bool true, false


TIFF

Node <OcadScript> Parameter Data type Values / Description
export file String eg.: ‚c:\Export\Chlosterwald.tif‘
If spotColors is enabled and
colorsCombine=false then the filename is
‚c:\Export\Chlosterwald. Spotcolor name.tif ‘
export format Enumerated types TIFF
export resolution Integer  
export anti-alias Bool true, false
export colorCorrection Bool true, false
export.partialMap enabled
coordSystem
 
L, R, B, T
 
Bool
Enumerated types
    Float
 
true, false
mm (paper), m (real world)
[only if partialMap=enable]
left, right, bottom ,top
[only if partialMap=enable]
export.tiles enabled
width
height
Bool
Integer
Integer
true, false
[only if enabled = true]
[only if enabled = true]
export.geoRefTiff enabled
pixelSize
createWorldFile
Bool
Float
Bool
true, false
in meter [only if enabled = true]
true, false [only if enabled = true]
export colors Enumerated types normal, spotColors
export colorsCombine Bool true, false [only if color = spotColors]
export.spotColors enabled Spotcolor name [only if color = spotColors]
export color Mode Integer 0 = 32 bit CMYK
1 = 24 bit RGB
2 = 256 colors
3 = grayscale
4 = 8 bit CMYK
5 = 1 bit black/white
6 = halftone screen
export compression Integer 1 = no compression
2 = CCITT
4 = FaxG4
5 = LZW


DXF

Node <OcadScript> Parameter Data type Values / Description
export file String eg.: ‚c:\Export\Chlosterwald.dxf ‘
export format Enumerated types DXF
export printScale Integer  
export convertOem Bool true, false
export convertUnicode Bool true, false
export objectsSelSym Bool true, false
export exportAsSplines Bool true, false
export coordinates Enumerated types mm, m


Shape

Node <OcadScript> Parameter Data type Values / Description
File.Export file String eg.: ‚c:\Export ‘ (only path name)
File.Export format Enumerated types SHAPE
File.Export Enabled Integer 0 = point objects
1 = line objects
2 = area objects
3 = text object
File.Export Dataset Integer All = Dataset - All objects
eg.: 2 (Objects in dataset with index = 2)

Example

The following example export an AI file and some BMP tiles. Each exportScript node can contain many children.

<ocadScript>                                           // comment:
 <exportScript>
   <export id="1">                                     // first export section 
     <file>c:\export\test.ai</file>                    // export file
     <format>AI</format>                               // file format
<partialMap>
       <enabled>true</enabled>
<coordSystem>mm</coordSystem>
<L>0</L>                                               // coordinates for the partial map
<R>50</R>
<B>50</B>
<T>100</T>
     </partialMap>
<printScale>10000</printScale>                         // export scale
     <colors>normal</colors>                           // cmky or spot colors
   </export>  
<export id="2">                                        // second export section
     <file>c:\export\exp.bmp</file>
     <format>BMP</format>
<resolution>300</resolution>                           // raster resolution
<anti-alias>true</anti-alias>
    <colorCorrection>true</colorCorrection>
<partialMap>
       <enabled>false</enabled>
     </partialMap>
<tiles>                                                // tiles export
       <enabled>true</enabled>                         // tile dimensions 
<width>500</width>
<height>500</height>
     </tiles>
   </export>
 </exportScript>
</ocadScript>


Previous Chapter: Database

Next Chapter: Course Setting for Orienteering

Back to Main Page