Command Line Build batch file
-
- Jr. Propeller Head
- Posts: 3
- Joined: Wed Feb 08, 2006 12:34 pm
- Location: California
-
- Senior Propellus Maximus
- Posts: 2089
- 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
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
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
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
Re: Command Line Build batch file
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.
What is a CLI? Everyone seems to know what that is. Nice post. Very important topic! We need to do something more with this.
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
Open Utilities PageLayout Resizer for Flare/Blaze | Batch builder
-
- Sr. Propeller Head
- Posts: 150
- Joined: Thu Feb 09, 2006 12:33 pm
- Location: Bracknell, Berkshire, UK
Re: Command Line Build batch file
Hi,
CLI = Command Line Interface. One example is the Command Prompt window in Windows.
Pete
CLI = Command Line Interface. One example is the Command Prompt window in Windows.
Pete
-
- Propellus Maximus
- Posts: 1979
- Joined: Tue Nov 28, 2006 11:18 am
- Location: Crossroads of the West
- Contact:
Re: Command Line Build batch file
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.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.
-
- Senior Propellus Maximus
- Posts: 2089
- 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
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...
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
-
- Sr. Propeller Head
- Posts: 130
- Joined: Mon Apr 24, 2006 12:52 pm
- Location: Glen Mills, PA
Re: Command Line Build batch file
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.
Regards,
Austin.
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.
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
Flare 2022 r3 (18.2.8431.26678) :: TopNav HTML5 / PDF output
-
- 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
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 .
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 to
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 .
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 .
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
Code: Select all
madbuild -project C:\Help\IWHelp\IW\IW.flprj
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 .
Marie-Claire
Flare 2019 r2 - Windows 10 Pro - HTML5 help / "clean" XHTML output
Flare 2019 r2 - Windows 10 Pro - HTML5 help / "clean" XHTML output
-
- Sr. Propeller Head
- Posts: 130
- Joined: Mon Apr 24, 2006 12:52 pm
- Location: Glen Mills, PA
Re: Command Line Build batch file
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.
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.
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.
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
Flare 2022 r3 (18.2.8431.26678) :: TopNav HTML5 / PDF output
-
- Senior Propellus Maximus
- Posts: 2089
- 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
Code: Select all
madbuild -project %1 >> c:\\temp\\madbuild.txt
The %1 is used as a placeholder for parameters, in this case the projects. It will run the batch file on the first parameter and then shift to the next and so on until all the parameters have been used. You can replace the %1 with your project path if you wish. I used it because I had the batch file on my desktop and would drag and drop a Flare project from Windows explorer onto the batch file to make it run.
>> c:\\temp\\madbuild.txt is a redirection. Rather than sending messages to the CLI window it sends them to a file in C\temp called madbuild.txt - and there is a bug in the batch file there! It should read >> c:\temp\madbuild.txt, one backslash, not 2!
You can ditch the echo. | date | find /I \"Current\" >> c:\\temp\\madbuild.txt, that just creates a timestamp in the log file. A more current version would be:
Code: Select all
echo %date% >> C:\temp\madbuild.txt
HTH
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
-
- Senior Propellus Maximus
- Posts: 2089
- 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
More on %1:
I included it so that I could run the batch file from the command line (or another batch file ) with something like:
And have a good coffee break. Or run it overnight, building the projects I specified.
I included it so that I could run the batch file from the command line (or another batch file ) with something like:
Code: Select all
madbuild C:\project1 C:\project2 C:\project3
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
-
- 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
Hi Steve and Austin
Thank you very much for your input. I will edit Steve's batch file (found the 2 backslashes a bit weird but thought there could be a valid reason for this) and try it out, and when I have time, I may give Austin's file a whirl.
Got diverted onto something else ( ) so will keep you posted when I come back to this.
Thank you very much for your input. I will edit Steve's batch file (found the 2 backslashes a bit weird but thought there could be a valid reason for this) and try it out, and when I have time, I may give Austin's file a whirl.
Got diverted onto something else ( ) so will keep you posted when I come back to this.
Marie-Claire
Flare 2019 r2 - Windows 10 Pro - HTML5 help / "clean" XHTML output
Flare 2019 r2 - Windows 10 Pro - HTML5 help / "clean" XHTML output
-
- 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
ok, just to let you know that I have run both Steve's and Austin's batch files after a few issues I encountered (thanks, Steve for your help on this forum, and thanks, Austin for the PMs ).
Removed the double backslashes in Steve's file and replaced all the occurrences of "C:\" by "c:\" (case-sensitive) and filled in properly the target names and custom batches in Austin's file and it all works smoothly.
So we have here two great batch files that I can certainly recommend!
Removed the double backslashes in Steve's file and replaced all the occurrences of "C:\" by "c:\" (case-sensitive) and filled in properly the target names and custom batches in Austin's file and it all works smoothly.
So we have here two great batch files that I can certainly recommend!
Marie-Claire
Flare 2019 r2 - Windows 10 Pro - HTML5 help / "clean" XHTML output
Flare 2019 r2 - Windows 10 Pro - HTML5 help / "clean" XHTML output
Re:
TheGreatAndPowerfulOz wrote: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.
Looking for a copy of this new and improved bat file. Does anyone know where I can find it?
thanks
Russ
Re: Command Line Build batch file !!found it!!
Sorry for the confusion (unecessary post). I found the zip file. Now Im just sussing it out. Ill follow up with a question or three in a bit.
thanks
-Russ
thanks
-Russ
-
- Sr. Propeller Head
- Posts: 130
- Joined: Mon Apr 24, 2006 12:52 pm
- Location: Glen Mills, PA
Re: Command Line Build batch file !!found it!!
russ wrote:Sorry for the confusion (unecessary post). I found the zip file. Now Im just sussing it out. Ill follow up with a question or three in a bit.
thanks
-Russ
Russ,
I'm not sure where you might have "found the zip file", but if you want to be sure you've got the latest which I've developed, just send me a Private Message through the forum with your e-mail address, and I can send it to you via e-mail.
Austin.
Austin Wright
Flare 2022 r3 (18.2.8431.26678) :: TopNav HTML5 / PDF output
Flare 2022 r3 (18.2.8431.26678) :: TopNav HTML5 / PDF output
-
- Senior Propellus Maximus
- Posts: 4293
- Joined: Thu Feb 02, 2006 9:29 am
- Location: The Electric City
Re: Command Line Build batch file
He probably downloaded the file that was attached to the post in this thread.
New Book: Creating user-friendly Online Help
Paperback http://www.amazon.com/dp/1449952038/ or https://www.createspace.com/3416509
eBook http://www.amazon.com/dp/B005XB9E3U
Paperback http://www.amazon.com/dp/1449952038/ or https://www.createspace.com/3416509
eBook http://www.amazon.com/dp/B005XB9E3U
-
- Sr. Propeller Head
- Posts: 130
- Joined: Mon Apr 24, 2006 12:52 pm
- Location: Glen Mills, PA
Re: Command Line Build batch file
Right-o! I forgot that I attached it last month.RamonS wrote:He probably downloaded the file that was attached to the post in this thread.
I think when I originally wrote the thing, I didn't have the ability to attach it, so was sending it via e-mail to interested parties.
Austin Wright
Flare 2022 r3 (18.2.8431.26678) :: TopNav HTML5 / PDF output
Flare 2022 r3 (18.2.8431.26678) :: TopNav HTML5 / PDF output
Re: Command Line Build batch file
Subject: Command Line Build batch file
I had a 2 questions.
1.)It looks like I can use this bat file to compile (build) but it doesnt seem to publish. Is there another parameter I need to pass to get it to publish?
My line looks like this:
madbuild -project %1 [-target OnlineAutoMoveHelp] >> "c:\Program Files\MadCap Software\madbuildlogs\madbuild.txt"
2.)When I run it I get Access denied - \ three times in the bat file window. Is this normal?
thanks
Russ
========================================doc_guy wrote: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.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.
I had a 2 questions.
1.)It looks like I can use this bat file to compile (build) but it doesnt seem to publish. Is there another parameter I need to pass to get it to publish?
My line looks like this:
madbuild -project %1 [-target OnlineAutoMoveHelp] >> "c:\Program Files\MadCap Software\madbuildlogs\madbuild.txt"
2.)When I run it I get Access denied - \ three times in the bat file window. Is this normal?
thanks
Russ
-
- Propellus Maximus
- Posts: 1979
- Joined: Tue Nov 28, 2006 11:18 am
- Location: Crossroads of the West
- Contact:
Re: Command Line Build batch file
I answered Russ in a PM, but I'll re-post my reply for all to see.
===
No, unfortunately the Madbuild.exe file won't publish your files to a publishing location. I just added code in my script to copy my files over to their published locations. (Which for me is a networked drive, not an ftp location, so this was quite easy.)
Here is my entire batch script. After that, I give you an annotated version.
Then I update my files from the source control to ensure I have the latest copy of all the files in my project.
Again, I don't remember what the switches do, but it has to do with copying all the files in all child directories, not prompting for overwrites, and some other stuff to ensure it copies all the files and overwrites existing content.
It's not eloquent, but it gets the job done for me. I'll probably try editing it in the next few days to add logging, like Steve's does and OZ's does, because it would be nice to know if something failed along the way (like for a while, I was getting a failure when trying to update my files from source control, but I didn't know it because all the other steps worked. The problem was I was then building and publishing outdated content because it wasn't updating files properly.)
Oh, and it is probably worth noting that on my computer I have three different SVN programs installed. I have a command line SVN client that runs this script. I have PushOK's plugin so my projects work properly in Flare. And I have TortoiseSVN for working within Windows menus for using source control.
Hope this helps.
===
No, unfortunately the Madbuild.exe file won't publish your files to a publishing location. I just added code in my script to copy my files over to their published locations. (Which for me is a networked drive, not an ftp location, so this was quite easy.)
Here is my entire batch script. After that, I give you an annotated version.
Here is the annotated versionsvn commit c:\svn\Projects\MyProject\trunk -m "Daily update from script"
svn update c:\SVN\Projects\MyProject\trunk
cd\Program Files\MadCap Software\MadCap Flare V4\Flare.app
madbuild -project c:\SVN\Projects\MyProject\trunk\ProjectName.flprj
cd\SVN\Projects\MyProject\trunk\Output\doc_guy
cd MyProject-Install-PDF
copy Installation.pdf N:\Distribute\PrintedDocs\ /y
cd ..
cd MyProject-PDF
copy User-Guide.pdf N:\Distribute\PrintedDocs\ /y
cd ..
cd MyProject-ReleaseNotes-PDF
copy ReleaseNotes.pdf N:\Distribute\PrintedDocs\ /y
cd
o:
xcopy MyProject n:\Distribute\WebHelp\ /Y/R/H/E/I
In this first section, I commit my changes to SVN (my source control program, with the commit message "daily update from script" (Because my source control will fail if I don't provide a commit message.)svn commit c:\svn\Projects\MyProject\trunk -m "Daily update from script"
svn update c:\SVN\Projects\MyProject\trunk
Then I update my files from the source control to ensure I have the latest copy of all the files in my project.
Here I switch directories to the MadBuild folder. You could do this in one step, but I dind't when I wrote it.cd\Program Files\MadCap Software\MadCap Flare V4\Flare.app
Here is where I build all my targets at once. I can't get the madbuild to only build a single project for some reason, so I just build all my targets at once.madbuild -project c:\SVN\Projects\MyProject\trunk\ProjectName.flprj
Now I change directories to the build location.cd\SVN\Projects\MyProject\trunk\Output\doc_guy
Now I open a folder that contains a PDF deliverable and copy the file to a network drive. I don't remember what the switch does, but I think it allows me to overwrite existing files without prompting.cd MyProject-Install-PDF
copy Installation.pdf N:\Distribute\PrintedDocs\ /y
Same thing as before. I open two different directories in my output folder and copy the pdf files to a network location.cd ..
cd MyProject-PDF
copy User-Guide.pdf N:\Distribute\PrintedDocs\ /y
cd ..
cd MyProject-ReleaseNotes-PDF
copy ReleaseNotes.pdf N:\Distribute\PrintedDocs\ /y
My webhelp builds in a different location than my PDF files do, so I change to my output directory for my Webhelp, and then use the xcopy command (which is a directory copy, rather than an individual file copy command).cd
o:
xcopy MyProject n:\Distribute\WebHelp\ /Y/R/H/E/I
Again, I don't remember what the switches do, but it has to do with copying all the files in all child directories, not prompting for overwrites, and some other stuff to ensure it copies all the files and overwrites existing content.
It's not eloquent, but it gets the job done for me. I'll probably try editing it in the next few days to add logging, like Steve's does and OZ's does, because it would be nice to know if something failed along the way (like for a while, I was getting a failure when trying to update my files from source control, but I didn't know it because all the other steps worked. The problem was I was then building and publishing outdated content because it wasn't updating files properly.)
Oh, and it is probably worth noting that on my computer I have three different SVN programs installed. I have a command line SVN client that runs this script. I have PushOK's plugin so my projects work properly in Flare. And I have TortoiseSVN for working within Windows menus for using source control.
Hope this helps.
-
- Propellus Maximus
- Posts: 1979
- Joined: Tue Nov 28, 2006 11:18 am
- Location: Crossroads of the West
- Contact:
Re: Command Line Build batch file
Oh, and I forgot to mention that my script is set up to be totally unattended. In fact, I have the bat file scheduled to run at midnight from my desktop. Our software builds at 3am, so my help files are always up to date in the daily build of the application, and the dates on the help build match the dates of the software build.
You can schedule a program using the Windows scheduler. (Shhhh... Doing this prevented me from needing to buy a build license for Flare. But I'm not saying you shouldn't buy a build license. It just saved my company a little bit of cash. YMMV.)
You can schedule a program using the Windows scheduler. (Shhhh... Doing this prevented me from needing to buy a build license for Flare. But I'm not saying you shouldn't buy a build license. It just saved my company a little bit of cash. YMMV.)
Re: Command Line Build batch file
Doc_guy
Thanks for the help...Im still not understanding one thing. It seems that when I build, I produce a directory in output that looks something like this:
C:\Program Files\MadCap Software\AutoMoveHelpMain\Output\build\Temporary
In that temp dir is a DepSets and OnlineAutoMoveHelp dir...but the directories I get when I go into the GUI and PUBLISH are:
Content
Data
Skin
and a whole bunch of stuff at the top level of Output.
My question is, Is there any way through the CLI (command line) to publish built content? I have to build nightly, then I have to publish.
I looked at your script, but "I just added code in my script to copy my files over to their published locations." Implies that you are publishing manually?
thanks
Russ
Thanks for the help...Im still not understanding one thing. It seems that when I build, I produce a directory in output that looks something like this:
C:\Program Files\MadCap Software\AutoMoveHelpMain\Output\build\Temporary
In that temp dir is a DepSets and OnlineAutoMoveHelp dir...but the directories I get when I go into the GUI and PUBLISH are:
Content
Data
Skin
and a whole bunch of stuff at the top level of Output.
My question is, Is there any way through the CLI (command line) to publish built content? I have to build nightly, then I have to publish.
I looked at your script, but "I just added code in my script to copy my files over to their published locations." Implies that you are publishing manually?
thanks
Russ
-
- Senior Propellus Maximus
- Posts: 4293
- Joined: Thu Feb 02, 2006 9:29 am
- Location: The Electric City
Re: Command Line Build batch file
Sorry top butt in here, but yes. The line "xcopy MyProject n:\Distribute\WebHelp\ /Y/R/H/E/I" copies all the files and folders to the publishing destination (in this case a network share) overwriting anything that is there. I am not that familiar with all the switches, but one weakness of doing only this is that when something gets removed or renamed the output does not get updated correctly, it will keep the old gunk in place. That is easy to fix by running rd beforehand, so with the example from doc_guy it should be "rd /S /Q n:\Distribute\WebHelp\" before running the xcopy. That basically first wipes the publishing destination clean and then writes all files new.
New Book: Creating user-friendly Online Help
Paperback http://www.amazon.com/dp/1449952038/ or https://www.createspace.com/3416509
eBook http://www.amazon.com/dp/B005XB9E3U
Paperback http://www.amazon.com/dp/1449952038/ or https://www.createspace.com/3416509
eBook http://www.amazon.com/dp/B005XB9E3U
-
- Sr. Propeller Head
- Posts: 342
- Joined: Mon Nov 03, 2008 9:33 am
- Location: The heart of America
Re: Command Line Build batch file
I learned about using a .bat file for building in the Flare training class. I have 26 project files that each has 2 targets (more to come) and when I leave for the night I run the .bat file. It builds all targets. Then I copy the word docs into one folder and copy the htmlhelp files to encrypt in the final software. It saves so much time, I highly recommend it.
The Moon is the first milestone on the road to the stars.
— Arthur C. Clarke
— Arthur C. Clarke