VSoft Technologies Blogs


VSoft Technologies Blogs - posts about our products and software development.

Today FB 6.1 was released as a beta version. One of the major new features in this version is Python language support. We're leveraging Microsoft's IronPython project for this, and because version 2 of IronPython is built on the Dynamic Language Runtime, we're expecting that as other DLR languages become available, we'll be able to support them in FinalBuilder as well.

The Python language is pretty neat, and the fact that IronPython interacts seamlessly with the .NET Framework makes it pretty powerful by itself. It shares this feature with PowerShell.

However, what really makes Python awesome is the amount of extra library functionality that comes with the standard language distribution.


This is a totally arbitrary example. Say your build process needs to calculate a SHA1 hash. FinalBuilder only supports MD5 at the moment. Can Python save the day?

Step One: Install Python Libraries

You need to install the Python standard libraries in order to get access to their many functions. You get this as part of the standard Windows Python distribution. Grab the "Windows Binary installer" from http://python.org/download/

Step Two: Tell FinalBuilder

You need to tell FinalBuilder where the Python library is installed. If you launch FinalBuilder and go to Tools -> Options -> FinalBuilder -> Script Options, as shown, you will see this options page:

Script Options Frame

Enter the path to the Python library directory, as shown here. The options page says you need to restart, but you actually only need to do this if you've run a Python script since you started FinalBuilder.

Step Three: Run Script Action

I use the Action filter to search for the all-purpose Run Script action, which I can then add to my project:

Actions Tab

Step Four: Type in Script

Here's my SHA1 script code. I entered this in the OnExecute event, under the Script Editor tab at the bottom of the main FinalBuilder IDE. Make sure you set the script language to "Python", as shown:

Script Editor view

Note that the FBVariables object behaves just like a normal Python dictionary.

Click here to download a sample project file.

Step Five: Run it!

Here's the log output from the SHA1 Run Script:

Log Output

Where do I go from here?

This was a pretty basic example, but the Python library provides you with literally hundreds of similar pieces of functionality. Take a look at the Python Library Reference for a complete list.

Can't I just use the .NET Framework?

Yes! The .NET Framework also provides you with a wealth of built-in functionality. Using it from IronPython is pretty simple, too. Here's Python code that performs the same functionality, written to use the .NET Framework instead of the Python library:

.NET Framework version

(It's a bit more complicated, mostly because I couldn't find a neat .NET-based way to convert a byte array to a hexadecimal string. Note that this approach does not require the Python libraries, it will work out of the box with FinalBuilder.)

Both sample scripts are included in the downloadable example.

It would also be possible to rewrite the .NET version to use PowerShell, instead. I'll leave that as an exercise.

Showing 2 Comments

Diego 13 years ago

Hi<br><br>I would like to know, how can I get a value from a variable that is set in the folder project variables to the script language, I promp for that value with the action "prompt value" and I saved to my variable, I need to modify that string in my script language.

frepe 13 years ago

I'm trying to use the python feature in Finalbuilder right now. I need to use os.system() in my build, but when importing "os" from within FB, the "os" module has no "system" member?? This is very odd. Running an IronPython shell clearly shows the system member and it also works as expected.<br><br>Do you know why this is so?

Comments are closed.