SDK - Tools - Command Line - Environment Variables (FSX/A)

From FSDeveloper Wiki
Revision as of 08:05, 7 August 2011 by BASys (Talk | contribs)

Jump to: navigation, search

A method to simplify working with the FSX/A SDK's command-line tools,
which makes them available in any folder, on any drive,
by configuring environment variables, (a one-time operation).

Overview

Default Method

Whilst you can drag a prepared file onto a desktop-shortcut to an SDK tool
and that prepared file will then be processed by the tool,
sometimes things don't go as expected.

Using the command-line tools can be a little awkward,
particularly when -

  • Your source information, or data files contain errors.
  • You are unfamiliar with DOS command-line operations, (e.g. changing folders).
  • You enter an incorrect path value.


Environment Variables Method

Environment variables - Global values or settings, (available across sessions).
in this case, just think of it as a dynamic shortcut.

Once applied, these environment variables will -

  • Be available in any subsequently launched Command Prompt Window session.
  • Allow you to launch an SDK tool directly from any folder.
  • Works across drives.
  • Output directly to the launching folder location, or any chosen location.
  • Ensure consistency and simplify/speed up your command-line entry.
  • Allow you to see any error messages

Each Environment variable comprises of a -

  • Variable name - A label that you enter.
  • Variable value - Whatever that label actually calls/does.


SDK's Tools

List of FSX/A SDK's tools that utilise the Command Prompt Window, (aka DOS box).

  • BGLComp - Compiling scenery placement, airport data, & mission rewards
  • Resample - Compiling elevation, land/water class, photoscenery, etc. data.
  • Shp2Vec - Compiling vector data.
  • ImageTool - Imagery format conversion for simobjects & scenery.
  • Simpropcompiler - Compiling XML gauges, autogen related files, & missions.


Implementing

Applicable to XP/Vista/Win7 operating systems -

  • Click Start -> Control Panel -> System
  • A dialog box opens.
  • Click the tab titled Advanced
  • Click the button labeled Environment Variables
  • A dialog box opens.


In the top section titled User Variables for <LOGIN-NAME>

  • Click the button labeled New
  • A dialog box opens.


Enter the -

  • Variable name.
  • Variable value.
  • Click apply.


Repeat for any additional variable name/value pairs.


Once finished adding the variable name/value pairs -

  • Click OK.
  • Click OK.


These environment variables will now be available in any subsequently launched Command Prompt Window session.


FS2004 specific variables

TODO - Add FS9 specific details.


FSX/A specific variables

These variable name/value pairs must be entered exactly as below,
(N.B. some utilise quotes, some don't).

The samples below are laid out as follows -

variable name

variable value


FSX paths - Core

Single-source base path variables essential for use in all tool variables.
This approach has been adopted to minimise -

  • configuration
  • possible path errors
  • path replication


Two examples below are for default installations.
If required, edit these paths to match your specific installation's locations

FSX_ROOT

C:\Program Files\Microsoft Games\Microsoft Flight Simulator X\
FSXSDK_ROOT

C:\Program Files\Microsoft Games\Microsoft Flight Simulator X SDK\SDK\

N.B. Trailing slash is essential.


Tool Paths - Optional

Variables for calling the individual tools.

NB
Generally, the variable names I've used are identical to the actual tool's names, (to ease remembering).

The variable values rely on concatenating the tool paths
and must be entered exactly as below.


BGLComp

BGLCompX

"%FSXSDK_ROOT%Environment Kit\BGL Compiler SDK\bglcomp.exe"

Note the appended X suffix in the variable name,
allowing differentiation between FSX and FS9 bglcomp versions.


ImageTool

ImageTool

"%FSXSDK_ROOT%Environment Kit\Terrain SDK\ImageTool.exe"

ImageTool will launch the GUI if no parameters are supplied.


Resample

Resample

"%FSXSDK_ROOT%Environment Kit\Terrain SDK\resample.exe"


Shp2Vec

Shp2Vec

"%FSXSDK_ROOT%Environment Kit\Terrain SDK\Shp2Vec.exe"

Shp2Vec default method useage requires a path parameter.
i.e.

Shp2Vec path string -flags

As the environment variable method is working in the context of the local folder,
just type a . to represent context of the local folder
i.e.

Shp2Vec . string -flags


Simpropcompiler

Simpropcompiler

"%FSXSDK_ROOT%Core Utilities Kit\SimProp\Simpropcompiler.exe"

An extra for any frequent .SPB creators.

SPC2SPB

%Simpropcompiler% 2spb -symbols "%FSX_ROOT%propdefs\*.xml"


Useage

Opening

In explorer, (file manager) -

  • Navigate to your project's data folder, (whatever you're intending to process)
  • Right-click on that folder
  • From the context-menu, left-click Open Command Window Here


Windows 7

  • Navigate to your project's data folder, (whatever you're intending to process)
  • SHIFT + Right-click on that folder
  • From the context-menu, left-click Open Command Window Here


Running

As you are calling a variable
you must always wrap it in % characters.


Testing

For test purposes to prove its working,
type in a %variable_name% , (case insensitive) -
e.g.

%bglcompx%

Pressing the return key, will now run bglcomp in the context of the local folder.

As you've not supplied any parameters
the tool will prompt you with example parameters.


Normal

For normal useage
type in a %variable_name% followed by any required parameters.

Example 1
%bglcompx% yourproject.xml

The output .bgl or .rwd will be in the current folder.

Example 2
%spb2spc% yourproject.xml

The output .spb will be in the current folder.


Related

Internal

External

Placeholder text

essay writing