Arguments

From FlashDevelop

Jump to: navigation, search

Contents

Introduction

Arguments are dynamic variables that can be used in templates, snippets, commands, menus and macros. These are processed on runtime and some of them require user interaction. There are also predefined arguments for the build process and these you can view in the project's setting dialog using the command builder dialog under the Build tab.

Arguments are either:

Different arguments are available depending on the execution context:


Default arguments

Here is a list of currently available default arguments:

Editor:

$(EntryPoint) - Selection's start position

$(ExitPoint) - Selection's end position

$(Boundary) - Keep all text between boundaries

$(CSLB) - Coding style line break (to optionally insert a line break before { characters)

$(CBI) - Comment block indentation style (to optionally insert a space before * in bloc comments)

$(STC) - Space or tab character based on the setting Use Tabs.

$(SelText) - Selected text

$(CurWord) - Word at cursor position

$(CurSyntax) - Currently active syntax

$(Clipboard) - Clipboard content

Filesystem:

$(CurFile) - Current file

$(CurFilename) - Current file's name

$(CurDir) - Current file's directory

$(DesktopDir) - User's desktop directory

$(SystemDir) - Windows system directory

$(ProgramsDir) - Program Files directory

$(PersonalDir) - User's personal files directory

$(WorkingDir) - Current working directory

$(AppDir) - FlashDevelop program directory

$(BaseDir) - FlashDevelop files directory

$(UserAppDir) - FlashDevelop user directory

$(ToolsDir) - FlashDevelop Tools directory

Prompt:

$(OpenFile) - Asks for a file open with a dialog

$(SaveFile) - Asks for a file save with a dialog

$(OpenDir) - Asks for a directory with a dialog

Project:

$(FDBuild) - path to FlashDevelop command line build tool

$(OutputFile) - project's Output file path (ie. C:\path\to\MyProject\bin\MyProject.ext)

$(OutputDir) - project's Output directory (ie. C:\path\to\MyProject\bin)

$(OutputName) - project's Output file name (ie. MyProject.ext)

$(ProjectName) - project's name (ie. MyProject)

$(ProjectDir) - project's Output directory (ie. C:\path\to\MyProject)

$(ProjectPath) - project's Output directory (ie. C:\path\to\MyProject\MyProject.fdproj)

$(BuildConfig) - project's target configuration (ie. release or debug)

$(TargetPlatform) - project's target platform (ie. Flash/JavaScript/etc.)

$(TargetVersion) - project's platform target version (ie. 11.1 for Flash target)

$(TargetBuild) - project's target build name (value entered in the second drop-down right to configuration)

$(CompilerPath) - path to the project's selected compiler SDK

Code model:

$(TypPkg) - File package

$(TypName) - Current type name

$(TypPkgName) - Current package + type name

$(TypKind) - Type kind (interface, class)

$(TypClosestListName) - Closest Array or Vector var name

$(TypClosestListItemType) - Closest Vector item type

$(MbrName) - Current member, ie. current method

$(MbrKind) - Member kind (const, var, function)

$(MbrTypPkg) - Member's type package

$(MbrTypName) - Members's type name

$(MbrTypePkgName) - Members's type qualified name

$(MbrTypKind) - Members's type kind (interface, class)

$(ItmTypName) - Current item name at cursor position

$(ItmFile) - File where the item is declared

$(ItmKind) - Item kind (const, var, function)

$(ItmTypPkg) - Item's type package

$(ItmTypName) - Item's type name

$(ItmTypePkgName) - Item's type qualified name

$(ItmTypKind) - Item's type kind (interface, class)

$(ItmUniqueVar) - Unique variable name (i, j... etc)

Here are examples of menu item using default arguments:

<button label="Open Explorer" click="RunProcess" tag="explorer.exe;/e,$(Quote)$(WorkingDir)$(Quote)" />
<button label="Run current file" click="RunProcess" tag="$(Quote)$(CurFile)$(Quote)" image="275|9|0|0" shortcut="F11" />

Dynamic arguments

Dynamic arguments are special variables that can specify default values and the values are confirmed from the user with a dialog. These variables are not in use by default as they may confuse users that don't know about them.

Here is an example snippet using default and dynamic arguments:

for (var i:int = $$(i=0); i < $$(count=array.length); i++) $(CSLB){
    $(EntryPoint)
}

Custom arguments

These are arguments that user can specify in the Custom Arguments dialog under the Tools menu. There is only one default argument used in the templates: $(DefaultUser)

Here is an example AS2 class template using default and custom arguments:

/**
$(CBI)* ...
$(CBI)* @author $(DefaultUser)
$(CBI)*/

class $(EntryPoint) $(CSLB){

}

Project template arguments

Project templates have very limited arguments support:

User created Custom Arguments (like $(DefaultUser), see Tools > Custom Arguments...) and the following list:

$(CBI) - comment block indentation style (to optionaly insert a space before * in bloc comments)

$(ProjectName) - original name of the project

$(ProjectID) - safe name of the project (for filenames for example)

$(PackageName) - specified package in new project dialog (ie. "com.foo")

$(PackageDot) - specified package with an ending dot if not empty (ie. "com.foo." or "" with no package)

$(PackagePath) - package as path (ie. "com\foo")

$(PackagePathAlt) - package as path with forward slashes (ie. "com/foo")

$(PackageSlash) - package as path with ending slash if not empty (ie. "com\foo\")

$(PackageSlashAlt) - package as path with ending forward slash (ie. "com/foo/")

These arguments will be replaced in:

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox