Command Line Build batch file

This forum is for all Flare related Tips and Tricks.
Have a tip or trick you use while working in Flare? Share it here.
SteveS
Senior Propellus Maximus
Posts: 2087
Joined: Tue Mar 07, 2006 5:06 pm
Location: Adelaide, far side of the world ( 34°56'0.78\"S 138°46'44.28\"E).
Contact:

Command Line Build batch file

Post by SteveS »

Fellow Propellor Heads

I've created a batch file for using the command line method of building projects and thought the nice thing would be to share.

You'll probably want to change the log file location.

Feel free to use it as you wish, but there are no guarantees, use it at your own risk :)

Code: Select all

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Batch file to automate building Flare Outputs            ::
:: Accepts Flare Project as parameter                       ::
:: Drag and drop project onto shortcut or batch file icon   ::
::                                                          ::
:: Created 16 Aug 2006 by Steve Salter                      ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

@echo off

:: Set CLI window title
Title Building Project

:: Show user something happened
echo Building project outputs, please wait

:: Change to Flare directory
cd C:\\Program Files\\Madcap Software\\Madcap Flare\\Flare.app

:: Create log
echo Project building started > c:\\temp\\madbuild.txt
echo. | date | find /I \"Current\" >> c:\\temp\\madbuild.txt
echo. | time | find /I \"Current\" >> c:\\temp\\madbuild.txt

:: Build project(s)
madbuild -project %1 >> c:\\temp\\madbuild.txt

:: Add completion time to log
echo Project building completed >> c:\\temp\\madbuild.txt
echo. | time | find /I \"Current\" >> c:\\temp\\madbuild.txt
With my larger projects I now have more than enough time to get a Starbucks while a CLI dominates my desktop :wink:
Image
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
RamonS
Senior Propellus Maximus
Posts: 4293
Joined: Thu Feb 02, 2006 9:29 am
Location: The Electric City

Post by RamonS »

Richard, Kevin, can we get this transferred to the KB before it disappears in the forum's nirvana?

For those who manage their help sources via source control, add CLI batch code to pull the sources from the source control. Our build engineer did this with great success, except that with RHX5 command line compiles of help were not possible. Now, Flare can do it, Yeah!! 8)

Just, can't you add some simple UI component to Flare that integrates with common source control systems. As far as I know CLI commands are available for all the major systems and should be fairly easy to be implemented in Flare...says me who programmed oh so many applications. :wink:
SteveS
Senior Propellus Maximus
Posts: 2087
Joined: Tue Mar 07, 2006 5:06 pm
Location: Adelaide, far side of the world ( 34°56'0.78\"S 138°46'44.28\"E).
Contact:

Post by SteveS »

Been building projects madly and have come up with a request (if anyone is listening?)

When you use the build button, or the command line, the flag the view button uses isn't reset. So, if you build your project (or individual target) and then click the view target button it reports the target isn't up to date. Annoying with a large build. :?
Image
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
claydevin
Jr. Propeller Head
Posts: 2
Joined: Mon Apr 24, 2006 2:29 pm

Problems viewing built output.

Post by claydevin »

That is a handy batch file, thanks.
So when the command line build completes, how does a person see the changes in the output? After successfully running a Madbuild for all targets I press the \"View the Primary Target\" button and it says the Webhelp Target is not up-to-date. After clicking No, the help displayed is that of the last time I pressed the build button, not that of the last command line build.

hope this makes sense.
SteveS
Senior Propellus Maximus
Posts: 2087
Joined: Tue Mar 07, 2006 5:06 pm
Location: Adelaide, far side of the world ( 34°56'0.78\"S 138°46'44.28\"E).
Contact:

Post by SteveS »

My builds are in the output -> my name -> target name directory.

I've just tested and the directories refreshed. What have you specified for build targets etc?
Image
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
claydevin
Jr. Propeller Head
Posts: 2
Joined: Mon Apr 24, 2006 2:29 pm

Post by claydevin »

I cleaned out all the output files and changed the 'Output Folder' in the Targets to simple paths all in the same folder. Not sure why the output was being buried into deeper folders but all is better now.
Thanks for the post(s).
TheGreatAndPowerfulOz
Sr. Propeller Head
Posts: 130
Joined: Mon Apr 24, 2006 12:52 pm
Location: Glen Mills, PA

Invalid registration code error

Post by TheGreatAndPowerfulOz »

SteveS,

Thanks for the batch file posting. I've been looking for some way to do this with Flare (was hoping there'd be a front-end \"batch build/publish\", like in RH).

I was all excited to try it out, but was disappointed to get the following error on attempting to execute the BAT file:

Code: Select all

Your MadCap Flare registration code is invalid.
I know darned well that my product is registered; my company's accounting department can attest to that! Any idea why I might be getting the error? Is this a known issue, perhaps, for which there's some sort of workaround?

Oh, forgot to mention that I still haven't upgraded to v2.0 of Flare. We've downloaded the setup package, but our IT group hasn't got around to scheduling the install for me yet. If the issue I'm seeing was \"known\", perhaps it's been addressed in v2.0?

Any suggestions you (or anyone else) could offer would be greatly appreciated.

Austin.
SteveS
Senior Propellus Maximus
Posts: 2087
Joined: Tue Mar 07, 2006 5:06 pm
Location: Adelaide, far side of the world ( 34°56'0.78\"S 138°46'44.28\"E).
Contact:

Invalid registration code

Post by SteveS »

Might be one for Rick or Neal - the thing that springs to mind is the command line build, which the batch file calls, is disabled in the trial version. Something screwy with your installation? :?
Image
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
TheGreatAndPowerfulOz
Sr. Propeller Head
Posts: 130
Joined: Mon Apr 24, 2006 12:52 pm
Location: Glen Mills, PA

Post by TheGreatAndPowerfulOz »

Thanks for the zippy response! Nothing out of the ordinary with the installation, as far as I know. I can live with building one target at a time until our IT gang gets around to installing v2.0 for me. I plan on having the two versions \"co-exist\" on my machine for a while, just to make sure everything goes alright, so I'll try the batch command with 2.0 to see if I get the same issue.

Austin.
Richard Ferrell
Propellus Maximus
Posts: 840
Joined: Mon May 01, 2006 10:11 am
Location: Inside California

Post by Richard Ferrell »

I've seen this issue sometimes if your company has a firewall, Let me know if its still is happening in version 2.0
Richard Ferrell

Certified Madcap Trainer
Image
TheGreatAndPowerfulOz
Sr. Propeller Head
Posts: 130
Joined: Mon Apr 24, 2006 12:52 pm
Location: Glen Mills, PA

Batch file on steroids

Post by TheGreatAndPowerfulOz »

All,

I'm glad to report that I got Flare v2.0 installed today and all is going well with the command line build process!

I figured I'd have a little fun with batch files \"while I was at it\" and came up with quite a spiffy one, based on the one posted here by Steve Salter. This file allows you to list as many of your Targets as you want as parameters, then when you run it, you can choose which one to build (or to build all Targets in the Project). I also tossed in an option dialogue for overwriting vs. appending the log file.

Just like Steve's file, mine is free for the taking. It is also as is, so use at your own risk! I've tested it against my own project and all is working swimmingly. I'm actually running it right now to build all my targets at once!

I was going to include the code here in my post, but it seems that there may be a character limit to what one is allowed to place inside the Code tag (looked OK in the Preview, but then got all messed up when I hit Submit). I'll try it again, but if it doesn't work I guess anyone interested in the batch file can contact me so I can e-mail it to you. I don't see a way to upload/attach a file here, either. :(

If you want the interface to look a bit \"nicer\" (as nice as a DOS window can look), make a shortcut on the Desktop to the .BAT file you create, then right-click it and set the Properties as follows:
  • Shortcut tab: Press the Change Icon... button and point to the icon at \"%ProgramFiles%\\MadCap Software\\MadCap Flare V2\\Flare.app\\Flare.exe\"

    Layout tab: Set the Width to 70 and Height to 30 for both the Screen buffer size and the Window size
Thanks to all who offered input as to how to get the command line functionality going for me!

Austin.
Richard Ferrell
Propellus Maximus
Posts: 840
Joined: Mon May 01, 2006 10:11 am
Location: Inside California

Post by Richard Ferrell »

If you want to email it to me, I can create a Knowledge base article of it, and SteveS batch file, Of course giving you credit for it :)

Click on the Email Button and send it to me

Thanks!
Richard Ferrell

Certified Madcap Trainer
Image
TheGreatAndPowerfulOz
Sr. Propeller Head
Posts: 130
Joined: Mon Apr 24, 2006 12:52 pm
Location: Glen Mills, PA

Post by TheGreatAndPowerfulOz »

Richard,

I've decided to tweak a few little things before I \"go public\", so I'll probably e-mail the BAT file to you within another day or so. Thanks!

Austin.
Richard Ferrell
Propellus Maximus
Posts: 840
Joined: Mon May 01, 2006 10:11 am
Location: Inside California

Post by Richard Ferrell »

Looking forward to seeing it, Thank you
Richard Ferrell

Certified Madcap Trainer
Image
TheGreatAndPowerfulOz
Sr. Propeller Head
Posts: 130
Joined: Mon Apr 24, 2006 12:52 pm
Location: Glen Mills, PA

Re: Problems viewing built output.

Post by TheGreatAndPowerfulOz »

claydevin wrote:... After successfully running a Madbuild for all targets I press the "View the Primary Target" button and it says the Webhelp Target is not up-to-date...
Through a little investigative work while creating my own batch file (I've e-mailed it to Richard Ferrell, by the way), I discovered that when you don't specify a target while running the command line build (when you build all targets), the flag that indicates "up-to-date-edness" is NOT flipped. If you DO specify a target, the flag IS flipped, so subsequent attempts to view or publish will reflect that output is up-to-date.

Austin.
BVega_LibertyIMS
Jr. Propeller Head
Posts: 3
Joined: Wed Feb 08, 2006 12:34 pm
Location: California

Post by BVega_LibertyIMS »

I just searched the Knowledge Base and don't see the updated Batch File in there. Rick, did you put it in there?

Thanks

Barb Vega
dom.reed
Jr. Propeller Head
Posts: 7
Joined: Tue Feb 14, 2006 5:54 am
Location: Bristol, UK

Post by dom.reed »

Hi
Just wondered if this batch file ever got posted on the knowledge base, or if someone could mail me with it, as I can't find it either and it sounds perfect!

Cheers
Dom
SteveS
Senior Propellus Maximus
Posts: 2087
Joined: Tue Mar 07, 2006 5:06 pm
Location: Adelaide, far side of the world ( 34°56'0.78\"S 138°46'44.28\"E).
Contact:

Command Line Batch File

Post by SteveS »

Hi Dom,

The code for the batch file is in the first post in this thread.

Copy it into notepad and save it as <filename>.bat - should work a treat :wink:
Image
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
forfear
Propellus Maximus
Posts: 766
Joined: Sat Feb 16, 2008 3:37 am
Location: Jungle Jingles

Re: Command Line Build batch file

Post by forfear »

Hi!

What is a CLI? Everyone seems to know what that is. Nice post. Very important topic! We need to do something more with this. :flare:
If you submit your bug feedback request here, the more likely it'll get fixed or included in a future release
Open Utilities PageLayout Resizer for Flare/Blaze | Batch builder
Pete Lees
Sr. Propeller Head
Posts: 150
Joined: Thu Feb 09, 2006 12:33 pm
Location: Bracknell, Berkshire, UK

Re: Command Line Build batch file

Post by Pete Lees »

Hi,

CLI = Command Line Interface. One example is the Command Prompt window in Windows.

Pete
doc_guy
Propellus Maximus
Posts: 1979
Joined: Tue Nov 28, 2006 11:18 am
Location: Crossroads of the West
Contact:

Re: Command Line Build batch file

Post by doc_guy »

forfear wrote:Hi!

What is a CLI? Everyone seems to know what that is. Nice post. Very important topic! We need to do something more with this. :flare:
For clarification, the purpose of the command line interface is that it allows you to build your Flare project as part of some larger script. So if you have a Windows build machine for your software, you can include a command to build and publish the Flare help system as well. Then when that completes, the script can pull over the latest version of the help system into the build.
Paul Pehrson
My Blog

Image
SteveS
Senior Propellus Maximus
Posts: 2087
Joined: Tue Mar 07, 2006 5:06 pm
Location: Adelaide, far side of the world ( 34°56'0.78\"S 138°46'44.28\"E).
Contact:

Re: Command Line Build batch file

Post by SteveS »

If you drag and drop the project onto the batch file (in Windows Explorer, for example) it will build all the targets in the project - so even on a stand-alone it has advantages! One action, 5 targets built. And plenty of time to drink a coffee... :wink:
Image
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
TheGreatAndPowerfulOz
Sr. Propeller Head
Posts: 130
Joined: Mon Apr 24, 2006 12:52 pm
Location: Glen Mills, PA

Re: Command Line Build batch file

Post by TheGreatAndPowerfulOz »

Has it really been nearly 3 years since I wrote my multi-target command line batch file? :|

Well, just for kicks, I decided to add some code to the batch file which will calculate the amount of time a build operation takes. The elapsed time (in hours, minutes and seconds) will display at the end of the process, and also be written to the log file.

I've posted the latest version here, if anyone is interested in it. I'll gladly answer any questions you may have about it via e-mail, or here in the forum.

The batch file has been tested on versions 2 to 4.1 of Flare. Works fine on all of 'em. :D

Regards,
Austin.
You do not have the required permissions to view the files attached to this post.
Austin Wright

Flare 2022 r3 (18.2.8431.26678) :: TopNav HTML5 / PDF output
MC Hammer
Sr. Propeller Head
Posts: 225
Joined: Wed Aug 08, 2007 3:04 am
Location: In a galaxy far, far away

Re: Command Line Build batch file

Post by MC Hammer »

Hi there
I have copied Steve's batch file (thank you for sharing) and tweaked it for my version of Flare (v4.0) and for my projects.
I am not familiar at all with the MS-DOS batch language (have read a few things on the Internet about the syntax though) and have a couple of questions as I do not think it is all working fine for me. I managed to batch-build all my targets (6 in total) in less than 45 min, which is quite good. No Starbucks here but I can do something else during these 45 mins 8) .
1/I do not think that the log file bit is working as I get two "access denied" lines in my Prompt Window when the batch file is clicked. The madbuild.txt file gets created and at the end of the batch-building process, only contains 2 lines informing me that the project building was started, then completed.
Do I need to edit the two echo. | date | find /I \"Current\" >> c:\\Temp\\madbuild.txt lines as these do not seem to work?
2/I am not sure I understood correctly what to do on the line that builds the project....
I have tweaked the original line from Steve

Code: Select all

madbuild -project %1 >> c:\\temp\\madbuild.txt
to

Code: Select all

madbuild -project C:\Help\IWHelp\IW\IW.flprj 
I had to remove the >> c:\\temp\\madbuild.txt bit as nothing seems to happen if I leave it in. My questions are:
a/do I need to specify which project to build or can I leave the line as the original one (project %1). I did not get the dragging n dropping of projects onto the batch file shortcut.
b/ what does the last part of the line >> c:\\temp\\madbuild.txt do?
Any help would be appreciated as I am struggling a bit with this code :cry: .
Marie-Claire
Flare 2019 r2 - Windows 10 Pro - HTML5 help / "clean" XHTML output
TheGreatAndPowerfulOz
Sr. Propeller Head
Posts: 130
Joined: Mon Apr 24, 2006 12:52 pm
Location: Glen Mills, PA

Re: Command Line Build batch file

Post by TheGreatAndPowerfulOz »

MC,

Hello! It's been some time since I've looked at Steve's code, so I can't comment specifically on it. Unfortunately, I don't have the time at present (when will I EVER?!) to delve into it, either. :cry:

I just thought I'd ask if you wanted to give the batch file I've posted here a whirl to see if it's any easier for you to configure and use (I tried to make it as easy as possible!). Please let me know, and I can certainly help with any questions you have with regard to it. :)

Regards,
Austin.
Austin Wright

Flare 2022 r3 (18.2.8431.26678) :: TopNav HTML5 / PDF output
Post Reply