<html>
   <head>
	   <title>
		   The Big List of WinBatch Hints.
		</title>
	</head>
	<body>
   	<dl>
				<dt>The Right-Click Menu
					<dd>Right-Click inside an Open WBT file to get the "Right-Click Context Menu".
					It's full of handy choices.  Try first clicking on any function in your 
					script, then right-click and choose "Keyword Lookup" from the menu for
					instant help.
				
				<dt>Fast help   Shift-F1
					<dd>Click on a <font color="#0000ff">function</font>, then type Shift-F1.<p>
					Either it will display the help page for the function, or, if QuickHelp
					option is set, it will display a short help message in the WinBatch Studio
					status bar and on a second pressing will then open the help page.
				
				
				<dt>BlackJack
					<dd>Double your bets when losing.<p>Hold the original bet when winning.
				
				<dt>Auto-complete - F12
					<dd>Example:<ul>
					<li>Type: x=<font color="#0000FF">strclean</font>
					<li>Hit F12 key
					<li>x=<font color="#0000FF">strclean</font>( sourcestring, characters, replacement,@<font color="#0000CC">True</font>|@<font color="#0000CC">False</font>, mode )
					<li>x=<font color="#0000FF">strclean</font>(x,"^","",@<font color="#0000CC">True</font>, mode )
					<li>Press <font color="#0000CC">SHIFT</font> & F1 to get mode codes info
					</ul>
				
				<dt>WinBatch Tech Forum
					<dd>Be sure to check out and participate on the WinBatch Tech Forum at
					<a href="http://forum.winbatch.com" target="_blank">http://forum.winbatch.com</a>.
					
				<dt>%Substitution% woes.
					<dd>Using "substitution" in WinBatch, where you put % signs around a variable
					name to have it replaced by the variable contents when it runs, is a handy but
					easily misused and dangerous technique.  Marty generally recommends that use
					of %substitution% be avoided at all costs.<p>
					The problem is that if you do not control the value of the variables, especially
					if typed in by a user or read from a database or other external source, then
					unusual values can cause your script to crash.  For example:<p>
					<pre>
					user="<font color="#ff0000">John Smith</font>"
					<font color="#0000ff">Message</font>('<font color="#ff0000">User name</font>','<font color="#ff0000">Name: %user%</font>')
					</pre>
					Seems to work fine, but then 
					<pre>
					user="<font color="#ff0000">William O'Rielly</font>"
					<font color="#0000ff">Message</font>('<font color="#ff0000">User name</font>','<font color="#ff0000">Name: %user%</font>')
					</pre>
					Suddenly causes an error.  The quote in the user's name confuses the 
					%substitution% and actually alters the statement so that it now contains an error.
					It should have been written as...
					<pre>
					user="<font color="#ff0000">William O'Rielly</font>"
					<font color="#0000ff">Message</font>('<font color="#ff0000">User name</font>',<font color="#0000ff">strcat</font>('<font color="#ff0000">Name: </font>',user))
					</pre>
					Thus avoiding the error.			
				
				<dt>To restore your workspace after startup:
					<dd><ul>
					<li>Select the View|Option menu.
					<li>Select the Editor tab.
					<li>Check the 'Restore Workspace at Startup' box.
					</ul>
				
				<dt>BookMarks
					<dd>On the Toolbar are several "flag" buttons.  These buttons
					allow you to set flags, or bookmarks, in your script so that you
					can rapidly get back to important parts of your script.<p>
					
					Just hit the "flag" button to place a temporary marker on sections
					of code you are working with.  Then you can use the other flag buttons 
					to quickly locate that section of code again.<p>
					
					This saves a lot of time when moving through your script.<p>
					
					For example you could set a bookmark at the location of the script
					you are working on and also at the beginning of any User Defined Functions
					or subroutines that you are using.
				
				<dt> ' " ` Quotes ` " '
					<dd>WinBatch can handle three different kinds of quotes:
					<ul><li>"doublequotes"
					  <li>'singlequotes'
					  <li>`backquotes`
					</ul>
					The documentation tends to use the "doublequotes" mostly because
					it reads easier when printed.  However they are all equivalent.
					<p>The rule is simply to use the same kind at the beginning and end of 
					a string, and then you can use the other two kinds inside.  <p>
					For Example:
					<pre>
					<font color="#0000ff">Message</font>("<font color="#ff0000">Quote Example</font>",`<font color="#ff0000">"Let's go!", he said.</font>`)
					</pre>


				<dt>Dialog Callback<br>Procedure Boilerplates
					<dd>Dialog Callback procedures are a powerful way to make WinBatch dialogs
					do many things.  However writing a Dialog CallBack procedure can get to be tedious.
					Hence, a right-click menu item is available to help this process.  Basically the
					steps are:
					<ul>
					<li>Create your dialog using the Dialog Editor.
					<li>When complete, save your dialog to the Clipboard using the FILE|Save To Clipboard menu item in the Dialog Editor.
					<li>Paste the dialog into your WBT file.  Note that it is best be very happy with your dialog before proceeding.
					<li>In your WBT file highlight, the entire dialog, from the FORMAT line to the Dialog line, and copy it to the clipboard.
					<li>Right-Click to bring up the right-click menu.
					<li>Chose CODE BLOCKS then CREATE DIALOG CALLBACK IN CLIPBOARD.
					<li>In an instant, your dialog will be analyzed, and suitable boilerplate placed on the clipboard.
					<li>Locate someplace in your script to place your new code, then paste it it.
					<li>It will require some editing, but it does save a tremendous amount of typing.
					</ul>
				
				<dt>Scissors
					<dd>Do <font color="#FF0000">not</font> run while holding scissors.
				
				
				<dt>GOTO's
					<dd>Goto's in Winbatch are a holdover from the very early days of WinBatch, way back when
					structure operators like <font color="#0000ff">While/EndWhile, Select/EndSelect, If/Else/Endif, For/Next
					and Switch/EndSwitch</font> did not even exist.<p>
					Using <font color="#0000ff">GoTo</font>'s in combination with structures takes special care.<p>
					In general, programs can be written without any use of the <font color="#0000ff">Goto</font> statement, and we 
					recommend that you strive to do this if using structures.<p>
					However sometimes it seems one must use a <font color="#0000ff">Goto</font>.  In this case, make sure that the jump
					from the GoTo does not cross *any* of the structure statements listed above.  Doing so
					<b>may</b> seem to work, and your test case may run fine, but it may be set up to fail
					near the 100th time thru a loop.<p>
					You have been warned....
				
				<dt>Basic File Reading
					<dd><font color="#00ff00">Text files only</font>
					<pre style="background-color:#f0f0f0; border:1pt solid #dddddd; padding:3pt; width:100%; font-style:normal; font-family:'Courier New'; font-size:10pt; font-weight:700; color:#000000; " title="color-ized by WBT2HTML">
					<font color="#000000">myfile</font><font color="#003080">=</font><font color="#000000">"</font><font color="#ff0000">c:\someplace\myfile.txt</font><font color="#000000">"</font>
					<font color="#000000">handle</font><font color="#003080">=</font><font color="#0000ff">FileOpen</font>(<font color="#000000">myfile</font>,<font color="#000000">"</font><font color="#ff0000">READ</font><font color="#000000">"</font>)
					<font color="#800080">While</font> @<font color="#0080ff">TRUE</font>
					&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">line</font><font color="#003080">=</font><font color="#0000ff">FileRead</font>(<font color="#000000">handle</font>)
					&nbsp;&nbsp;&nbsp;&nbsp;<font color="#800080">If</font> <font color="#000000">line</font><font color="#003080">==</font><font color="#000000">"</font><font color="#ff0000">*EOF*</font><font color="#000000">"</font> <font color="#800080">Then</font> <font color="#800080">Break</font>
					&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">Pause</font>(<font color="#000000">"</font><font color="#ff0000">Showing the current line</font><font color="#000000">"</font>,<font color="#000000">line</font>)
					<font color="#800080">EndWhile</font>
					<font color="#0000ff">FileClose</font>(<font color="#000000">handle</font>)
					<font color="#0000ff">Message</font>(<font color="#000000">"</font><font color="#ff0000">All</font><font color="#000000">"</font>,<font color="#000000">"</font><font color="#ff0000">Done</font><font color="#000000">"</font>)
					</pre>
					See Also: FileGet and FileGetW.
				
				<dt>Tech Database
					<dd>See the WinBatch Knowledgebase at
					<a href="http://techsupt.winbatch.com" target="_blank">http://techsupt.winbatch.com</a>.					
				
				<dt><font color="#ff0000">Backup your Source Code</font>
					<dd>Be sure to keep your source code in a safe place. One day you will need to go back and edit it, and it is virtually impossible (prohibitively expensive) to uncompile your executable."
				
				<dt>Stock market
					<dd>Buy low<p>Sell high.
				
				<dt>Select Statements with Strings
				    <dd>WinBatch Select/Switch statements work with integers.  
					 here is an example of how to do it with strings:
				
					<pre style="background-color:#f0f0f0; border:1pt solid #dddddd; padding:3pt; width:100%; font-style:normal; font-family:'Courier New'; font-size:10pt; font-weight:700; color:#000000; " title="color-ized by WBT2HTML">
					<font color="#000000">sdata</font><font color="#003080">=</font><font color="#000000">"</font><font color="#ff0000">abc</font><font color="#000000">"</font>   <font color="#008000">; variable to control the select/switch</font>
					
					<font color="#000000">sdata</font><font color="#003080">=</font><font color="#0000ff">StrLower</font>(<font color="#000000">sdata</font>)   <font color="#008000">; standardize the case</font>
					
					<font color="#800080">Select</font> @<font color="#0080ff">TRUE</font>
					&nbsp;&nbsp;&nbsp;<font color="#800080">Case</font> <font color="#000000">sdata</font><font color="#003080">==</font><font color="#000000">"</font><font color="#ff0000">cat</font><font color="#000000">"</font>
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">result</font><font color="#003080">=</font><font color="#000000">"</font><font color="#ff0000">It is a feline</font><font color="#000000">"</font>
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#800080">Break</font>
					
					&nbsp;&nbsp;&nbsp;<font color="#800080">Case</font> <font color="#000000">sdata</font><font color="#003080">==</font><font color="#000000">"</font><font color="#ff0000">dog</font><font color="#000000">"</font>
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">result</font><font color="#003080">=</font> <font color="#000000">"</font><font color="#ff0000">It is a canine.</font><font color="#000000">"</font>
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#800080">Break</font>
					
					&nbsp;&nbsp;&nbsp;<font color="#800080">Case</font> <font color="#000000">sdata</font><font color="#003080">==</font><font color="#000000">"</font><font color="#ff0000">abc</font><font color="#000000">"</font>
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">result</font><font color="#003080">=</font><font color="#000000">"</font><font color="#ff0000">It's some leters of the alphabet.</font><font color="#000000">"</font>
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#800080">Break</font>
					
					&nbsp;&nbsp;&nbsp;<font color="#800080">Case</font>  @<font color="#0080ff">TRUE</font>
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">result</font><font color="#003080">=</font><font color="#000000">"</font><font color="#ff0000">It's something else</font><font color="#000000">"</font>
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#800080">Break</font>
					<font color="#800080">EndSelect</font>
					<font color="#0000ff">Message</font>(<font color="#000000">sdata</font>,<font color="#000000">result</font>)
					</pre>


				<dt>List Variables
					<dd>List variables are just regular strings that have a separator character called a 
					"delimiter" separating parts of the string into smaller strings, such as<br>
					<font color="#00ff00">Apple-Banana-Cantaloupe-Durian-Fruitcake-Grape</font> <br>
					which would be a list variable using a hyphen as a delimiter.<p>
					
					The delimiter must be a single character, as the hyphen is in this case. Almost all
					of the WinBatch functions that return a list variable (e.g. <font color="#0000ff">FileItemize</font>) will use a
					tab as the delimiter.  In your code you can refer to a tab with the constant @TAB.<p>
					
					The various ITEMxxx functions, such as <font color="#0000ff">ItemCount</font> and <font color="#0000ff">ItemExtract</font> can easily work with
					list variables.<p>
					
					Note that the often used @CRLF (carriage-return line-feed) constant consists of two 
					characters and is not a suitable delimiter for a list variable.<p>
					
					Here is a quick trick to read an entire standard text file into memory and convert
					it to a list:
					<! [2005:01:06:18:35:19] Syn-tax checked by Syn-taxChecker (c) 2001-2002 Steffen Fraas sfrass@zoo.co.uk -->
					<! Color-ized html by WBT2HTML.WBT Version 1.18 (c)20010729-20020807.Detlev Dalitz -->
					<pre style="background-color:#f0f0f0; border:1pt solid #dddddd; padding:3pt; width:100%; font-style:normal; font-family:'Courier New'; font-size:10pt; font-weight:700; color:#000000; " title="color-ized by WBT2HTML">
					<font color="#000000">myfile</font><font color="#003080">=</font><font color="#000000">"</font><font color="#ff0000">c:\someplace\myfile.txt</font><font color="#000000">"</font>    <font color="#008000">; Define source file name</font>
					<font color="#000000">temp</font><font color="#003080">=</font><font color="#0000ff">FileGet</font>(<font color="#000000">myfile</font>)                <font color="#008000">; Load it into a variable</font>
					<font color="#000000">mylist</font><font color="#003080">=</font><font color="#0000ff">StrReplace</font>(<font color="#000000">temp</font>,@<font color="#0080ff">CRLF</font>,@<font color="#0080ff">TAB</font>)  <font color="#008000">; Convert @CRLF line endings to @TAB's</font>
					</pre>
								
				<dt>Quick ways to read files in one swell foop:
					<dd><ul>
					<li><font color="#0000ff">FileGet</font>()
					<li><font color="#0000ff">ArrayFileGet</font>()
					<li><font color="#0000ff">ArrayFileGetCSV</font>()
					</ul>
				
				<dt>Teeth.
					<dd>Brush twice daily.  You will thank us for this tip when you're 60.
				
				<dt>Ctrl-Shift-o
					<dd>Ctrl-Shift-o (o as in open) will open a highlighted file.  For example
					if you have a #INCLUDE statement or a CALL to a file, you have just highlight 
					the file with the mouse, then type Ctrl-Shift-o to open the file.
								
				<dt>Insert WIL Function...
					<dd>On the Right-Click menu, the item "Insert WIL Function" can insert an
					entire function template directly into your script.  Just right-click where
					you wish to place the function template, find it on the menus and click it.
								
				<dt>Auto-complete - F12
					<dd>In your WBT file, type in the name of a function, say, <font color="#0000ff">StrIndex</font>, then
					hit the {F12} key. A template line for the parameters will be inserted. i.e.
					<ul>
					<li>Type<br> <font color="#0000ff">StrIndex</font>
					<li>Hit the {F12} key
					<li>And it turns into<br><font color="#0000ff">StrIndex</font>( basestring, substring, start, @Fwdscan|@Backscan )
					<li>Next, for extra credit, type Shift-{F1}
					<li>and then the help for that function appears.
					</ul>

				<dt>Skim the WIL  files
					<dd>Look in your WinBatch folder and see the various help files in there.  Open them up
					(especially the <font color="#0000ff">Windows Interface Language.chm</font>) and skim them.<p>
					Take a quick look at what the function does, and keep a hazy recollection of it for future
					reference.<p>
					Once you see what kinds of functions are available to you, hard problems often become much simpler.
				
				<dt>Examine the Consolidated WIL help file
					<dd>Look in your WinBatch folder and find the <font color="#0000ff">ConsolidatedWIL.chm</font><br>
					That file is a merged list of the WIL related help files on your system.  Examine it carefully. Find
					the various extenders and see what they can do  You will be coming back to this file over and over.
				
				<dt>IntControl functions
					<dd>The <font color="#0000ff">IntControl</font> functions are a mixed lot. There is a lot of rather obscure stuff in there.
					It would be a good idea to skim the documentation for IntControl and see what is there.
				
				<dt>Comment Your Code
					<dd>Add comments to your code, especially the tricky bits, so that someone else (perhaps us here
					in Tech Support) can figure it out.<p>
					Realistically, it will probably be you, sometime next year, and under a deadline to fix some
					obscure incompatibility with Microsoft's latest security patches.<p>
					It will be time well worth spending now.<p>
					And Comments are easy.  Just type a semicolon ( ;) and jot down some notes.
					<blockquote>
					<font color="#00ff00"> ; See. Comments are easy to type.<br>
					; Either on their own line, or after<br>
					 ; a line of code.<br>
					 X=5   ; like this</font><br>
					</blockquote>
				
				<dt>The Code-Blocks menu
					<dd>On the right-click menu is "Code Blocks".  With this menu item you can:
					<ul>
					<li>Highlight several lines of code, then select the "Comment block of code
					    to turn them all into comments.
					<li>Highlight a block of commented , then select the "Uncomment block of code
					    to remove the comment characters at the beginning of the line.
					<li>Use the "Insert Block" menu to insert code or comment templates.
					</ul>

				<dt>Food.
					<dd>Eat healthy foods.  You will thank us for this tip when you're 90.
				
				<dt>General Hints
					<dd>
					<ul>
					<li>Since arrays are passed by reference, they can be used to pass groups of values out of functions.
					<p>
					<li>Develop large programs in small units, then assemble the units together.
					<p>
					<li>Use Functions to compartmentalize sections of code. This keeps blocks of code from interfereing 
					with each other, and makes the overall program easier to understand.
					<p>
					<li>Never turn off ERRORMODE for more than one line of code -- always turn it back on immediately. 
					If left off, errormode will make malfunctions impossible to correctly diagnose, and you will waste 
					weeks fixing a 5 minute problem.
					</ul>
				
				<dt>Shift-F2<br>Colorize your Variables
					<dd>Click on a variable name.  Then hit Shift-F2. This will colorize all occurances
					of a variable in your progrwm.  Investigate similar colorization functions under the right-click
					"More..." menu.
				
				<dt>Update your WinBatch
					<dd><ul>
					<li>Check on your maintenance plan status. START-&gt;All Programs-&gt;WinBatch-&gt;WinBatch.exe will 
					bring up WinBatch Navigator on your screen.  Click the "License Info" button in the lower left corner.  
					The little dialog that come up should tell you the expiration date of your maintenance plan.
					<p>A Free one year maintance plan comes with the original purchase of the software license.
					<li>
					<p>Get the latest updates to WinBatch and the extenders (or to renew a mainteance plan) from WinBatch's
					<a href="http://www.winbatch.com/download.html" target="_blank">Download Central</a>.
					</ul>
				
				<dt>Keep Your Extenders Up To Date
					<dd>
					<ul>
					<li>Start by downloading the <a href="http://files.winbatch.com/wwwftp/wb01/vcheck.zip" target="_blank">vCheck</a> utility.
					<li>Unzip the vcheck.zip and place the files in a subdirectory under WinBatch.
					<li>Run vcheck.wbt. The script requires a connection to the internet. 
					<li>You'll see in the dialog a list of suggested extenders to update, and other extenders available for installation. 
					<li>Make your selections and hit the update button. 
					</ul>
					Note: This tool requires that you have both the WinInet and Zipper extender installed. WinInet is 
					installed by default. The Zipper Extender can be downoloaded
					here: <a href="http://files.winbatch.com/wwwftp/wb01/wwzip44i.zip" target="_blank">Zipper Extender</a>.

			<dt>*EOF*
			   <dd>*EOF*
			 <!-- AND THAT WAS SPECIAL LAST ONE -->
			</dl>



   </body>
</html>
