<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Clarion Edge &#187; Templates</title>
	<atom:link href="http://www.clarionedge.com/category/clarion/templates/feed" rel="self" type="application/rss+xml" />
	<link>http://www.clarionedge.com</link>
	<description>Get an Edge with Clarion!</description>
	<lastBuildDate>Mon, 06 Feb 2012 13:58:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Generate SubVersion template</title>
		<link>http://www.clarionedge.com/clarion/examples/generate-subversion-template.html</link>
		<comments>http://www.clarionedge.com/clarion/examples/generate-subversion-template.html#comments</comments>
		<pubDate>Tue, 19 Apr 2011 10:01:24 +0000</pubDate>
		<dc:creator>brahn</dc:creator>
				<category><![CDATA[Examples]]></category>
		<category><![CDATA[Templates]]></category>

		<guid isPermaLink="false">http://www.clarionedge.com/?p=632</guid>
		<description><![CDATA[A while back on the ClarionLive skype chat I mentioned this template and promised to upload a version. I completely forgot all about it a few days later but here it is finally! 
This template [...]]]></description>
			<content:encoded><![CDATA[<p>A while back on the <a href="http://www.clarionlive.com/" target="_blank">ClarionLive</a> skype chat I mentioned this template and promised to upload a version. I completely forgot all about it a few days later but here it is finally! </p>
<p>This template just calls up <a href="http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-subwcrev.html" target="_blank">SubWCRev.exe</a> which is shipped with <a href="http://tortoisesvn.net/" target="_blank">TortoiseSVN</a>. After that it is up to you to arrange to compile the details into your EXE or DLL. This is very easy to do using the VersionRes.TPL shipped with Clarion but it should also work fine with any other similar template designed to include values from an external file. </p>
<p>At this point I don’t intend to ship a fully working example but hopefully the following explanation will be enough to get you going.</p>
<h3>The Template:</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
</pre></td><td class="code"><pre class="clarion" style="font-family:monospace;">#TEMPLATE(ClarionEdge_GenerateSubVersion, 'ClarionEdge Generate Sub Version'), FAMILY('ABC'),FAMILY('CW20')
#!*********************************************************************************************************
#EXTENSION(ce_EnableGenerateSubVersion,'Generate SubVersion Revision Number'),APPLICATION,FIRST
#!*********************************************************************************************************
#SHEET 
  #TAB('General')
    #DISPLAY('Generate SubVersion'), AT(10,,,30), PROP(PROP:FontStyle, FONT:bold), PROP(PROP:FontSize, 14)
    #DISPLAY('This Extension Template will enable automatic generating of the SubVersion Revision Number for the specified working copy.'), AT(10,,150, 30), PROP(PROP:FontStyle, FONT:italic)
    #DISPLAY('')
    #PROMPT('Activate Generate Subversion',CHECK), %GenerateSubVersionON, DEFAULT(0), AT(10)
    #DISPLAY('')    
    #BOXED(''), WHERE(%GenerateSubVersionON=1)    
       #PROMPT('Location of SubWCRev:',OPENDIALOG( 'Select SubWCRev', 'SubWCRev.exe|SubWCRev.exe' )),%RunSubWCRev,DEFAULT('%ProgramFiles%\TortoiseSVN\bin\SubWCRev.exe')
       #DISPLAY('Can be found in &quot;%ProgramFiles%\TortoiseSVN\bin\&quot;'), PROP(PROP:FontStyle, FONT:italic), PROP(PROP:FontColor, 00808080h)
       #DISPLAY('')
       #PROMPT('Working copy root:',@s255),%RunParamRoot,DEFAULT('.\')
       #PROMPT('Source version file:',OPENDIALOG( 'Source Version File', 'Source Version Information|*.in|All Files|*.*' )),%RunParamSource,DEFAULT('SubVersion.in')
       #PROMPT('Destination version file:',OPENDIALOG( 'Destination Version File', 'Source Version Information|*.in|All Files|*.*' )),%RunParamDest,DEFAULT('SubVersion')
       #DISPLAY('e.g. Use this destination file as the input for versionres.tpl'), PROP(PROP:FontStyle, FONT:italic), PROP(PROP:FontColor, 00808080h)
       #DISPLAY('')
       #DISPLAY('Run Command Used (refreshed after generation):'), PROP(PROP:FontStyle, FONT:italic), PROP(PROP:FontColor, 00808080h)
       #PROMPT('Run Command:',TEXT),%RunCommand,PROP(PROP:READONLY,1), PROP(PROP:Background, 00808080h)
    #ENDBOXED
  #ENDTAB
#ENDSHEET
#!
#AT(%AfterGeneratedApplication), WHERE(%GenerateSubVersionON=%TRUE)
  #IF( NOT FILEEXISTS( %RunParamDest ) )
    #INSERT(%BuildCommand)
  #ENDIF
#ENDAT
#!
#AT(%ShipList), WHERE(%GenerateSubVersionON=%TRUE)
  #REPLACE(%RunParamDest &amp; '.version' , %RunParamDest)
  #REMOVE(%RunParamDest)
#ENDAT
#!
#!****************************************************************
#GROUP(%BuildCommand)
#!****************************************************************
#DECLARE(%ThisRootParam)
#SET(%ThisRootParam, %RunParamRoot)
#SET(%RunCommand, '&quot;' &amp; %RunSubWCRev &amp; '&quot; ' &amp; %ThisRootParam &amp; ' ' &amp; %RunParamSource &amp; ' ' &amp; %RunParamDest)
#! Update 26-01-2011 - now uses a batch file because #RUN is broken again PTSS#37470 
#CREATE('GenerateSubVersion.bat')
%RunCommand
#CLOSE('GenerateSubVersion.bat')
#RUN('GenerateSubVersion.bat'),WAIT
#REPLACE(%RunParamDest &amp; '.version' , %RunParamDest)
#!****************************************************************</pre></td></tr></table></div>

<p>&#160;</p>
<p><span class="note">This template has only been tested with Clarion7 ABC but it should work fine in C6 as well as legacy applications.</span> </p>
<h3>Some screenshots that should explain how I use it:</h3>
<p>&#160;</p>
<p>1. Add the global extension to your application</p>
<p><a href="http://www.clarionedge.com/wp-content/uploads/image53.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="GenerateSubVersion template dialog with default values" border="0" alt="GenerateSubVersion template dialog with default values" src="http://www.clarionedge.com/wp-content/uploads/image_thumb45.png" width="227" height="244" /></a></p>
<p>Note the name of the “Source version file”. This is the template used as the input for SubWCRev. Here is an example of how you might want to use it:</p>
<p><span class="note">You will need to create this “SubVersion.in” file yourself. The destination file “SubVersion” is generated for you)</span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
</pre></td><td class="code"><pre class="clarion" style="font-family:monospace;">! These values are compiled into the application version file.
! The indenting is intended to match the indenting already in the destination file.
PRODUCTVERSION 1,1,0,$WCREV$
      VALUE &quot;ProductName&quot;, &quot;TestGenerateSubVersion\0&quot;
      VALUE &quot;ProductVersion&quot;, &quot;5.1.$WCREV$.$WCDATE=%d %B %Y$&quot;
&nbsp;
&nbsp;
==================================
Format options for $WCDATE$:
&nbsp;
strftime 
Syntax: 
  #include &lt;ctime&gt;
  size_t strftime( char *str, size_t maxsize, const char *fmt, struct tm *time );
&nbsp;
The function strftime() formats date and time information from time to a format specified by fmt, then stores the result in str (up to maxsize characters). Certain codes may be used in fmt to specify different types of time:
&nbsp;
Code Meaning 
%a abbreviated weekday name (e.g. Fri) 
%A full weekday name (e.g. Friday) 
%b abbreviated month name (e.g. Oct) 
%B full month name (e.g. October) 
%c the standard date and time string 
%d day of the month, as a number (1-31) 
%H hour, 24 hour format (0-23) 
%I hour, 12 hour format (1-12) 
%j day of the year, as a number (1-366) 
%m month as a number (1-12). Note: some versions of Microsoft Visual C++ may use values that range from 0-11. 
%M minute as a number (0-59) 
%p locale's equivalent of AM or PM 
%S second as a number (0-59) 
%U week of the year, (0-53), where week 1 has the first Sunday 
%w weekday as a decimal (0-6), where Sunday is 0 
%W week of the year, (0-53), where week 1 has the first Monday 
%x standard date string 
%X standard time string 
%y year in decimal, without the century (0-99) 
%Y year in decimal, with the century 
%Z time zone name 
%% a percent sign 
&nbsp;
The strftime() function returns the number of characters put into str, or zero if an error occurs.
&nbsp;
Related topics: 
gmtime
localtime
time</pre></td></tr></table></div>

<p>2. Add the global Version Resource template and configure it to use the destination file specified in the GenerateSubVersion template:</p>
<p><a href="http://www.clarionedge.com/wp-content/uploads/image54.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Clarions VersionRes.tpl configured to use an external file" border="0" alt="Clarions VersionRes.tpl configured to use an external file" src="http://www.clarionedge.com/wp-content/uploads/image_thumb46.png" width="244" height="164" /></a></p>
<p>3. Compile your application and if all goes well you should now have your SubVersion build compiled into your version resource!<br />
  <br /><a href="http://www.clarionedge.com/wp-content/uploads/image55.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Compiled EXE with SVN revision information!" border="0" alt="Compiled EXE with SVN revision information!" src="http://www.clarionedge.com/wp-content/uploads/image_thumb47.png" width="181" height="244" /></a></p>
<p>The SVN revision in this example is &quot;2&quot; and as you can see I have chosen to include the rev date as well. The date could be useful to automatically include the Copyright year for example…</p>
]]></content:encoded>
			<wfw:commentRss>http://www.clarionedge.com/clarion/examples/generate-subversion-template.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>#RUN parameter limits and hiding command windows</title>
		<link>http://www.clarionedge.com/windows/tools/run-and-command-windows.html</link>
		<comments>http://www.clarionedge.com/windows/tools/run-and-command-windows.html#comments</comments>
		<pubDate>Sun, 08 Feb 2009 20:23:23 +0000</pubDate>
		<dc:creator>brahn</dc:creator>
				<category><![CDATA[Examples]]></category>
		<category><![CDATA[Templates]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.clarionedge.com/?p=192</guid>
		<description><![CDATA[Recently I have been doing a fair amount of work trying to automate parts of the development process, in particular the version control aspects. I ran into what appeared to be limitations in the length [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I have been doing a fair amount of work trying to automate parts of the development process, in particular the version control aspects. I ran into what appeared to be limitations in the length of parameters accepted by the Clarion templates #RUN statement. Searching the newsgroups there were a few comments from people having similar issues and the symptoms were seemed a little sporadic. I decided that the safest way was to write the commands out to a temporary batch file and use #RUN to just call that.<br />
<span id="more-192"></span><br />
This works great and has the added advantage of being able to execute, obviously, batches of commands in one go.  The thing that is annoying about this is that you <em>will</em> get the command window popping up when the command is run. Often this is fine, especially for long tasks where it is nice to see the progress but sometimes it is annoying and it would to be nice to be able to hide the window.</p>
<p>There are a few ways to do this but essentially they all seem to revolve around the <a href="http://msdn.microsoft.com/en-us/library/ms682425.aspx" target="_blank">CreateProcess</a> api Function.</p>
<ol>
<li>Write a helper DLL that wraps the CreateProcess function and can be easily called by the templates.</li>
<li>Find something that already does this so I don&#8217;t have to.</li>
</ol>
<p>If you want to go for option 1 in clarion you might like to look into <a href="http://www.berthume.com/powerrun.htm" target="_blank">PowerRun</a> from Berthume Software which is available for free download. And of course you can dig right in and make the function call directly.  However, if there is something suitable around I much prefer to use that.</p>
<p>After a quick search I found these two options:</p>
<ul>
<li>CHP.EXE (Create Hidden Process) &#8211; <a href="http://www.commandline.co.uk/chp/" target="_blank">http://www.commandline.co.uk/chp/</a></li>
<li>hidden Start (hstart.exe) &#8211; <a href="http://www.ntwind.com/software/utilities/hstart.html" target="_blank">http://www.ntwind.com/software/utilities/hstart.html</a></li>
</ul>
<p>I tried CHP first and it certainly does what it says it will but I found I wanted the option to wait until the spawned task was finished. In comes hstart. Hstart is pretty awesome. Lots of options and it also, funnily enough, does what it says it will&#8230;</p>
<p style="text-align: center;"><a href="http://www.clarionedge.com/wp-content/uploads/hstart_help21.png"><img class="size-medium wp-image-196 aligncenter" title="hstart_help21" src="http://www.clarionedge.com/wp-content/uploads/hstart_help21-242x246.png" alt="hstart_help21" width="242" height="246" /></a></p>
<p>For anyone interested, this is the template code I ended up with for calling hidden commands in a clarion template:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="clarion" style="font-family:monospace;">#GROUP(%RunCommandHidden, %Command, %TestMode=%FALSE),AUTO
#!
#DECLARE(%BatchFileName)
#! We need to write the command out to a batch file for execution because
#! the #RUN command seems to have issues with the length of the command!
#SET(%BatchFileName, 'run.bat')
#SET(%BatchFileName, FullName(%BatchFileName, 2))
#CREATE(%BatchFileName)
%Command
#CLOSE(%BatchFileName)
#! Now we call the batch file for execution
#! using cph.exe for &quot;Create Hidden Process&quot;
#IF(%TestMode=%FALSE)
  #RUN('hstart.exe /NOCONSOLE /WAIT ' &amp; %BatchFileName),WAIT
#ELSE
  #RUN('hstart.exe /WAIT ' &amp; %BatchFileName),WAIT
#ENDIF
#REMOVE(%BatchFileName)
#RETURN</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.clarionedge.com/windows/tools/run-and-command-windows.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  www.clarionedge.com/category/clarion/templates/feed ) in 0.47150 seconds, on Feb 7th, 2012 at 11:21 am UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 7th, 2012 at 12:21 pm UTC -->
