FBuilder a tool to help working with multiple targets

03.19.2014 2310 0


Project XML file

A simple project file looks like that :

<!--<fbuilder always-on-top="false" taskbar="true" stick-edge="50">-->
	<target name="hss" color="#FFFF00"><![CDATA[
		execute( "hss.exe", [ "-output", "www/css/", "src/hss/default.hss" ] );
	<target name="templo" color="#00FF00"><![CDATA[
		var err	= "";
		var out	= "";
		for( i in [ "login", "shell", "news", "media", "album", "picture", "live" ] ){
			var p	= new sys.io.Process( "temploc2.exe", [ i + ".mtt", "-cp", "src/mtt", "-output", "www/tpl", "-macros", "macro.mtt" ] );
			out	+= p.stdout.readAll().toString();
			err	+= p.stderr.readAll().toString();
		{ out : out, err : err }
	<target name="neko" color="#FF0000"><![CDATA[
		execute( "haxe", [ "neko.hxml" ] );
	<target name="js" color="#0000FF"><![CDATA[
		execute( "haxe", [ "js.hxml" ] );
	<target name="notepad" color="#FF00FF"><![CDATA[
		command( "c:/Windows/notepad.exe", [] );
	<target name="test" color="#FFFFFF"><![CDATA[
		"The last line in the script is the console output ! :)";
	<target name="test2" color="#999999"><![CDATA[
		var rd	= sys.FileSystem.readDirectory( "." );
		var a	= [];
		for( i in rd ){
			if( StringTools.endsWith( i, ".log" ) ){
				sys.io.File.copy( i, "_old_" + i );
				a.push( i );

You can define special attributes as seen at the top of the xml in the commented node if you don't want the tool to be always on the top of the screen for example and then...


Inside the CData node, you write your hscript that will be executed once the button clicked.
These things are available in the HScript context :

  • StringTools
  • Sys
  • sys.FileSystem
  • sys.io.File
  • sys.io.Process

And 3 shortcut functions :

process( cmd : String, args : Array<String> ) : { out : String, err : String }
execute( cmd : String, args : Array<String> ) : { out : String, err : String }
command( cmd : String, args : Array<String>, keepPrompt = false ) : Void

The "process" and "execute" functions are the same. They run a background process and display stdout & stderr.
The "command" function launches a program in a separated Thread with or without the prompt. It was not done for that at the begining but it can help anyway


You can download the source and the Windows' executable here.
I've built it on Windows but it can run on Mac or linux without Windows' linked systools (tray icon).

Building from sources

You'll need to modify a bit the SWHX, Systools and HScript libs to make it compiling right for Haxe 3.
If you have some problems don't hesitate to ask.

Hope that helps !


Write a comment