I have blogged on this before including details on how to use it etc. I’ll in the main, skip all of that and cut to the chase with some scripts that I use.

About

PBScripts are a structured alternative to batch files that you create to run in the Platform Builder (PB) Build context.

I initially used them for some PB plug-ins such as CEDriverWiz and CEComponentWiz so that when they run they get the metainformation about the current OS project.

  • When you create one they get stored in <Your Documents>\PBScripts folder.
  • Note that if you add one manually to that folder, you have to restart Visual Studio/PB before you can access them.

PBScripts are created, configured and run from :

    • Menu—>Tools—>Platform Builder—>Configure Scripts
      Or
  • Menu—>Tools—>Platform Builder—>Run Active Script.
  • There is also an option to show the Scripts Panel for running and showing the progress of a script.

image

The PBScripts Menus


image

The PBScripts Dialog

image

PBScripts Insert a command options

image

PBScripts Run Dialog


image

PBScripts are just text files under Documents


  • Note that you can also assign shortcut keys which is useful as the dialog for them can be rather cumbersome to use.

Some PBScripts – 1

Just copy each script and save as a text file in <Documents>\PBScripts, but with .pbscript extension rather than .txt.

The scripts were created in VS2008 but scripts should work OK in VS2012 and 2013 except for macros.

BuildAll

VSVersion=9.0
Name=BuildAll
TargetDetach()
SetConfig("Debug")
BldDemo(-q)
SetConfig("Release")
BldDemo(-q)
SetConfig("Release No Kitl")
BldDemo(-q)

ReBuildAll

VSVersion=9.0
Name=ReBuildAll
TargetDetach()
SetConfig("Debug")
BldDemo(clean -q)
SetConfig("Release")
BldDemo(clean -q)
SetConfig("Release No Kitl")
BldDemo(clean -q)

BuildAllBSPandSubprojects

VSVersion=9.0
Name=BuildBSPEtc_All
TargetDetach()
VSCommand(-Macros.MyMacros.PBScripts.CloseAllButOutput)
SetConfig("Debug")
BldDemo(-qbsp)
SetConfig("Release")
BldDemo(-qbsp)
SetConfig("Release No Kitl")
BldDemo(-qbsp)

Build

This next script builds the OS in its current configuration but closes all open files except Output. The purpose of this is to make sure nk.bin isn’t open which would block the makeimage phase. (I get caught on this a lot!) I think that a simple check at the start of the build should be included in the build process. The – in the VSCommand is to ignore all errors, eg. if there is nothing to close.

VSVersion=9.0
Name=BuildAll
TargetDetach()
VSCommand(-Macros.MyMacros.PBScripts.CloseAllButOutput)
BldDemo(-q)

It requires a macro module, MyMacros.PBScripts, with the macro CloseAllButOutput

Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports System.Diagnostics

Public Module PBScripts
    Sub CloseAllButOutput()
        DTE.Windows.Item(Constants.vsWindowKindOutput).Activate()
        DTE.ExecuteCommand("File.CloseAllButThis")
    End Sub
End Module