{"id":658,"date":"2013-08-22T22:44:52","date_gmt":"2013-08-22T22:44:52","guid":{"rendered":"http:\/\/tregner.com\/flare-blog\/?p=658"},"modified":"2013-08-22T22:58:14","modified_gmt":"2013-08-22T22:58:14","slug":"automating-imports","status":"publish","type":"post","link":"https:\/\/tregner.com\/flare-blog\/automating-imports\/","title":{"rendered":"Automating Imports"},"content":{"rendered":"<p dir=\"ltr\">If you work with more than a few projects that import from a common project, you may want to automate importing from that project. Automating imports can be as simple as scheduling this command:<\/p>\n<pre class=\"lang:default decode:true\">madbuild.exe -project \"c:\\example\\example.flprj\" -target \"build-for-import.fltar\"<\/pre>\n<blockquote><p>\u00a0How does that work? Isn\u2019t madbuild.exe for generating output content?<\/p><\/blockquote>\n<p>Yes. But some other things happen when a target is built.<\/p>\n<p><span style=\"line-height: 1.714285714; font-size: 1rem;\">Flare targets have an Auto-Sync feature that enables running an import prior to generating content. Auto-Sync can be disabled for a target from the Target Editor. The setting is on the <strong>General<\/strong> tab, under <strong>Auto-Sync: Disable auto-sync of all import files<\/strong>. When not checked, the option is specified in the target file markup as a DisableAutoSync=&#8221;false&#8221; attribute and value on the CatapultTarget element. The value is true when the box is checked.<\/span><\/p>\n<p><span style=\"line-height: 1.714285714; font-size: 1rem;\">Flare imports have a setting on the <strong>Source Project<\/strong>\u00a0tab called <strong>Auto-reimport before \u201cGenerate Output\u201d<\/strong>. \u00a0Targets with Auto-Sync enabled will prompt an import specified by the import files with the <strong>Auto-reimport before \u201cGenerate Output\u201d<\/strong> option selected. The markup for this option is AutoSync=&#8221;true&#8221; on the CatapultProjectImport element.<\/span><\/p>\n<p><span style=\"line-height: 1.714285714; font-size: 1rem;\">The command line executable that enables starting builds outside of the Flare user interface is called madbuild.exe. It is located in the folder where Flare is installed. When a target is built with madbuild.exe, Auto-Sync is still run if specified. However if the project is under source control, madbuild.exe does not prompt for a checkout as happens in the Flare interface. But more about that later.<\/span><\/p>\n<p>By the way, this post is a follow-up to a previous discussion about batch files called\u00a0<a href=\"https:\/\/tregner.com\/flare-blog\/batch-files-madbuild-exe-and-commands\/\" target=\"_blank\">Batch Files, madbuild.exe, and commands<\/a>.<\/p>\n<p dir=\"ltr\">Setting up automated imports is accomplished by scheduling builds of targets that cause an import with Auto-Sync. Builds can be scheduled by placing build commands in a batch file and scheduling a call to the batch file with Windows Scheduler.<\/p>\n<p dir=\"ltr\">The target can be a throw-away that builds a one topic TOC. The output doesn&#8217;t matter. The target is just a means to get madbuild.exe to cause an import.<\/p>\n<blockquote><p><span style=\"line-height: 1.714285714; font-size: 1rem;\">But I use source control and madbuild.exe does not prompt me to check files in or out.<\/span><\/p><\/blockquote>\n<p><span style=\"line-height: 1.714285714; font-size: 1rem;\">Depending on your source control solution, you can automate that also. For example with Team Foundation Server and Visual Studio (Team Explorer), the executable is tf.exe and it is located in a Visual Studio folder.<\/span><\/p>\n<p><span style=\"line-height: 1.714285714; font-size: 1rem;\">One thing to watch out for is that not every file in a project should be checked in and out of source control. Some folders are local such as the Output folder in the root of the project and Users folders in the Project folder. The second example that follows shows this.<\/span><\/p>\n<h2>Build Commands<\/h2>\n<pre class=\"lang:default decode:true\" title=\"Build Commands\">rem set these for your project\r\nrem set the target down below\r\nset projectfolder=\"C:\\flare-projects\\example\"\r\nset projectname=\"example.flprj\"\r\nset flarefolder=\"C:\\Program Files (x86)\\MadCap Software\\MadCap Flare V9\\Flare.app\"\r\ncd \"%flarefolder%\"\r\nrem set target here and add other lines as necessary\r\nmadbuild.exe -project \"%projectfolder%\\%projectname%\" -target \"build-for-import.fltar\"\r\nrem madbuild.exe -project \"%projectfolder%\\%projectname%\" -target \"build-for-import.fltar\"<\/pre>\n<p>&nbsp;<\/p>\n<h2>Build with TFS Source Control Commands<\/h2>\n<pre class=\"lang:default decode:true\" title=\"Build with TFS Source Control Commands\">rem set these for your project\r\nrem set the target down below\r\nset projectfolder=\"C:\\flare-projects\\example\"\r\nset projectname=\"example.flprj\"\r\nset visualstudiofolder=\"C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Common7\\IDE\"\r\nset flarefolder=\"C:\\Program Files (x86)\\MadCap Software\\MadCap Flare V9\\Flare.app\"\r\ncd \"%visualstudiofolder%\"\r\ntf.exe checkout \"%projectfolder%\\Content\" \/recursive \/noprompt\r\ntf.exe checkout \"%projectfolder%\\Project\\Advanced\" \/recursive \/noprompt\r\ntf.exe checkout \"%projectfolder%\\Project\\ConditionTagSets\" \/recursive \/noprompt\r\ntf.exe checkout \"%projectfolder%\\Project\\Destinations\" \/recursive \/noprompt\r\ntf.exe checkout \"%projectfolder%\\Project\\Glossaries\" \/recursive \/noprompt\r\ntf.exe checkout \"%projectfolder%\\Project\\Imports\" \/recursive \/noprompt\r\ntf.exe checkout \"%projectfolder%\\Project\\Skins\" \/recursive \/noprompt\r\ntf.exe checkout \"%projectfolder%\\Project\\Targets\" \/recursive \/noprompt\r\ntf.exe checkout \"%projectfolder%\\Project\\TOCs\" \/recursive \/noprompt\r\ntf.exe checkout \"%projectfolder%\\Project\\VariableSets\" \/recursive \/noprompt\r\ncd \"%flarefolder%\"\r\nrem set target here and add other lines as necessary\r\nmadbuild.exe -project \"%projectfolder%\\%projectname%\" -target \"build-for-import.fltar\"\r\nrem madbuild.exe -project \"%projectfolder%\\%projectname%\" -target \"build-for-import.fltar\"\r\ncd \"%visualstudiofolder%\"\r\ntf.exe checkin \"%projectfolder%\\Content\" \/recursive \/noprompt\r\ntf.exe checkin \"%projectfolder%\\Project\\Advanced\" \/recursive \/noprompt\r\ntf.exe checkin \"%projectfolder%\\Project\\ConditionTagSets\" \/recursive \/noprompt\r\ntf.exe checkin \"%projectfolder%\\Project\\Destinations\" \/recursive \/noprompt\r\ntf.exe checkin \"%projectfolder%\\Project\\Glossaries\" \/recursive \/noprompt\r\ntf.exe checkin \"%projectfolder%\\Project\\Imports\" \/recursive \/noprompt\r\ntf.exe checkin \"%projectfolder%\\Project\\Skins\" \/recursive \/noprompt\r\ntf.exe checkin \"%projectfolder%\\Project\\Targets\" \/recursive \/noprompt\r\ntf.exe checkin \"%projectfolder%\\Project\\TOCs\" \/recursive \/noprompt\r\ntf.exe checkin \"%projectfolder%\\Project\\VariableSets\" \/recursive \/noprompt<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you work with more than a few projects that import from a common project, you may want to automate importing from that project. Automating imports can be as simple as scheduling this command: madbuild.exe -project &#8220;c:\\example\\example.flprj&#8221; -target &#8220;build-for-import.fltar&#8221; \u00a0How does that work? Isn\u2019t madbuild.exe for generating output content? Yes. But some other things happen&hellip; <a class=\"more-link\" href=\"https:\/\/tregner.com\/flare-blog\/automating-imports\/\">Continue reading <span class=\"screen-reader-text\">Automating Imports<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[22,76,20,74,75],"_links":{"self":[{"href":"https:\/\/tregner.com\/flare-blog\/wp-json\/wp\/v2\/posts\/658"}],"collection":[{"href":"https:\/\/tregner.com\/flare-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tregner.com\/flare-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tregner.com\/flare-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tregner.com\/flare-blog\/wp-json\/wp\/v2\/comments?post=658"}],"version-history":[{"count":6,"href":"https:\/\/tregner.com\/flare-blog\/wp-json\/wp\/v2\/posts\/658\/revisions"}],"predecessor-version":[{"id":664,"href":"https:\/\/tregner.com\/flare-blog\/wp-json\/wp\/v2\/posts\/658\/revisions\/664"}],"wp:attachment":[{"href":"https:\/\/tregner.com\/flare-blog\/wp-json\/wp\/v2\/media?parent=658"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tregner.com\/flare-blog\/wp-json\/wp\/v2\/categories?post=658"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tregner.com\/flare-blog\/wp-json\/wp\/v2\/tags?post=658"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}