LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scripting a BuildSpec

Solved!
Go to solution

I need to use scripting to add a file to a buildspec and have the buildspec set to rename the file when it runs.

I can add the file OK, but I can't figure out how to set the buildspec to do the renaming.  Has anyone else done this?
scr.png

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 1 of 7
(1,907 Views)

I believe this is possible with the App Builder API, a hidden gem that isn't officially supported:

 

[LabVIEW 20xx]\vi.lib\AppBuilder\AB_API

 

There are a couple of examples for the API in the 'examples' subfolder of the API. As for renaming a source item, I think you would use Build\Rename.vi.

 

If you can't get the App Builder API to work, the more hacky answer is that you could manipulate the .lvproj XML to change the setting.

 

 

Message 2 of 7
(1,904 Views)

@Darren wrote:

I believe this is possible with the App Builder API, a hidden gem that isn't officially supported:

 

[LabVIEW 20xx]\vi.lib\AppBuilder\AB_API

 

There are a couple of examples for the API in the 'examples' subfolder of the API. As for renaming a source item, I think you would use Build\Rename.vi.

 

If you can't get the App Builder API to work, the more hacky answer is that you could manipulate the .lvproj XML to change the setting.

 

 


Thank you.  The Build\Rename.vi does indeed set the source file to be renamed in the build.  My next challenge is  to convert a BuildSpec reference to BuildSpec object; To minimize scripting, I'm using a template .lvproj file with a pre-existing BuildSpec.  I can easily get a reference to it; but I need it in object form in order to use Build\Rename.vi,

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 3 of 7
(1,881 Views)

Check out the examples I mentioned. They show you how to go from a project reference to the app builder api reference. 

0 Kudos
Message 4 of 7
(1,872 Views)

@Darren wrote:

Check out the examples I mentioned. They show you how to go from a project reference to the app builder api reference. 


I checked out the examples in C:\Program Files (x86)\National Instruments\LabVIEW 2018\vi.lib\AppBuilder\AB_API\examples.

They all create a new buildspec; they don't script on an existing buildspec.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 5 of 7
(1,869 Views)
Solution
Accepted by topic author paul_cardinale

In the examples, the VI that creates the new build spec is called "Create New" something, like "Create New EXE". If you look on disk next to to the Create New VI, you'll see a corresponding Open VI. So for example, Create New EXE.vi is here:

 

[LabVIEW 20xx]\vi.lib\AppBuilder\AB_API\EXE\Create New EXE.vi

 

...which means the VI you would use to open an existing EXE build spec is here:

 

[LabVIEW 20xx]\vi.lib\AppBuilder\AB_API\EXE\Open EXE.vi

0 Kudos
Message 6 of 7
(1,854 Views)

Thank you very much.

(Note: It also took me a while to realize that I also need "Commit Build Settings.vi")

"If you weren't supposed to push it, it wouldn't be a button."
Message 7 of 7
(1,838 Views)