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

From FSDeveloper Wiki
Revision as of 10:05, 30 May 2010 by BASys (talk | contribs) (Environment Variables Method)
Jump to: navigation, search

A method to simplify working with the FSX/A SDK's command-line tools,
by applying 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 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.

MS Cmd Here Powertoy

An automatic method, removing the need to navigate to your required directory/folder location.
Provides a CMD prompt link on the right-click context menu.
See - MS Cmd Here Powertoy

Operating System

Implementing by operating system -

XP

Implementing in XP.

  • 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.

Vista

TODO - Add Vista specifics.

Windows 7

TODO - Add Windows 7 specifics.

FSX/A specific variables

These variable name/value pairs must be entered exactly as below, (N.B. some have 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

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\

Tool Paths - Optional

Variables for calling the individual tools.

NB
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"

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

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