﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-&lt;DIV id="ddm_Title"&gt;&lt;H1&gt;大大毛&amp;nbsp;&lt;i class="little"&gt;的笔记&lt;/i&gt;&lt;/H1&gt;&lt;H2&gt;&amp;nbsp&amp;nbsp;DDM's Note&lt;/H2&gt;&lt;/DIV&gt;-文章分类-&lt;b value="04" class="ddm_Item"&gt;400&lt;/b&gt;</title><link>http://www.blogjava.net/tw-ddm/category/37554.html</link><description>&lt;div id="ddm_subTitle"&gt;
&lt;h2 class="catchline"&gt;
        哪怕没有办法一定有说法,&lt;br/&gt;
        就算没有鸽子一定有乌鸦,&lt;br/&gt;
        固执无罪&amp;nbsp;梦想有价,&lt;br/&gt;
        让他们惊讶.
&lt;/h2&gt;
&lt;/div&gt;</description><language>zh-cn</language><lastBuildDate>Sat, 10 Apr 2010 17:36:55 GMT</lastBuildDate><pubDate>Sat, 10 Apr 2010 17:36:55 GMT</pubDate><ttl>60</ttl><item><title>利用TN5250NF下載檔案的自動化處理</title><link>http://www.blogjava.net/tw-ddm/articles/254262.html</link><dc:creator>大大毛</dc:creator><author>大大毛</author><pubDate>Wed, 11 Feb 2009 07:51:00 GMT</pubDate><guid>http://www.blogjava.net/tw-ddm/articles/254262.html</guid><wfw:comment>http://www.blogjava.net/tw-ddm/comments/254262.html</wfw:comment><comments>http://www.blogjava.net/tw-ddm/articles/254262.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tw-ddm/comments/commentRss/254262.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tw-ddm/services/trackbacks/254262.html</trackback:ping><description><![CDATA[
		<p>
				<font size="2">
						<font face="Georgia">
								<strong>問題</strong> <br /><br />   現在有遇到一個需求，是想直接利用TN5250來實現400端資料的下載：<br />   1. 僅通過TN5250來完成，不要使用其他的元件；<br />   2. 匯出資料格式為TXT檔案，應該是要能夠放到局域網路上；<br />   3. 匯出資料的動作需要做成排程方式(例如每天匯出)；<br />   4. 需求相當的急。<br /><br />   使用TN5250NF可以直接抓400端資料到PC端，匯出成TXT/XLS等格式的文件。匯出功能實際由TN4002PC來完成，該功能使用起來非常方便。通過簡單設定連線/設定參數即可實現資料的下載。<br /><br />   如果不考慮到需要做成排程方式來自動進行，則完全可以以人工方式來實現1-2。<br /><br /><br /><strong>思考</strong><br /><br />   要做直接利用程式的功能來實現自動化，首先應先弄清楚作業的方式是怎樣，先來看看手工是怎樣下載的。<br />   1. 點選TN5250上的菜單“傳送”-&gt; “從主電腦接收檔案”即可打開功能畫面(<strong>圖1</strong>)：<br /><br /><img title="TN4002PC功能畫面" height="462" alt="o_TN4002PC_01.GIF" src="http://www.blogjava.net/images/blogjava_net/tw-ddm/10051/o_TN4002PC_01.GIF" width="486" border="0" /><br /><br />   2. 需要配置參數(<strong>圖2</strong>)：<br /><img title="TN4002PC設定畫面" height="462" alt="o_TN4002PC_02.GIF" src="http://www.blogjava.net/images/blogjava_net/tw-ddm/10051/o_TN4002PC_02.GIF" width="486" border="0" /><br />   &gt;&gt; 注意紅色框部分，輸出必須要設為“檔案”，而筆數=0則表示將該檔案中全部資料都DOWN，&gt;0則表示最大下載筆數(如設為20則僅下載20筆資料)。其他部分根據需要自行配置。<br />   &gt;&gt; 檔案名稱處定義需要存放匯出檔案的名稱及路徑，如果需要在網路路徑上匯出文檔則必須先將網絡路徑映射為本地磁盤(通過“我的電腦”上右鍵“連線網路磁碟機”即可將一個網絡路徑映射成本地盤符)，然後再使用，否則會提示錯誤。<br /><br />   3. 點選上圖的“開始接收(R)”即可以開始從400下載資料到PC，接收完成後會跳出訊息提示框(<strong>圖3</strong>)：<br /><img title="TN4002PC作業訊息" height="121" alt="o_TN4002PC_03.GIF" src="http://www.blogjava.net/images/blogjava_net/tw-ddm/10051/o_TN4002PC_03.GIF" width="236" border="0" /><br /><br />   另外，還可以利用圖2上的“檔案”菜單來實現對參數配置的保存以及載入(Default是存成.tt0檔案)。<br /></font>
						<br />
				</font>
				<font face="Georgia" size="2">   通過查看保存配置後生成的快捷方式，可以發現其快捷方式內容實際為(<strong>圖4</strong>)：<br /><img title="TN4002PC作業快捷方式" height="473" alt="o_TN4002PC_04.GIF" src="http://www.blogjava.net/images/blogjava_net/tw-ddm/10051/o_TN4002PC_04.GIF" width="367" border="0" /><br />   &gt;&gt; 紅色部分即為我保存的配置檔--配置檔實際是一個INI文件，可使用記事本打開<br /><br />   因此，使用“TN4002PC.EXE /f=配置檔名稱”這樣的形式即可從命令行實際對此功能的調用(先要將參數都配置好存在配置檔中)。OK，現在剩下就是要將這個命令行能夠被放在“計劃任務”中。<br /><br />   通過手工測試可以發現有一些問題還待解決：<br /><strong><font color="#ff0000">   1. 在匯出完成後一定會有訊息框跳出(圖3)，這個是相當於MSGBOX的窗口，它會將整個程式阻塞在那裏，如果不將它消掉(回車或空格)就會造成多次處理出錯。<br />   2. 配置參數時無法為匯出的TXT文檔指定一個動態名稱，因為是要自動將匯出資料放在一個固定路徑下，所以每回匯出的文檔名稱都應該有所不同，例如保存成帶日期格式。</font></strong><br /><br /><br /><strong>解決方法</strong><br /><br />   因為是需要動態生成匯出文檔名以及消掉作業完成後的MSGBOX訊息框，所以是必須要有程序來協助解決，程序使用VBS來實現(先前有想到用BAT，但是無法解決MSGBOX的問題)。<br />   程式的處理方法：<br />   1. 利用VBS來動態生成TTO配置文件，只要每次修改掉保存的文件名稱就好，這樣就可以每次生成的TXT都有所不同。<br />         解析保存配置的TTO檔案，提取PC_FILENAME設定，在文件名後加上處理的日期和時間(路徑/文件類型保持不變)，最後再存成一個新的TTO配置檔。<br />   2. 利用VBS來執行CMD命令(命令格式見圖4)，完成對匯出功能的調用。<br />         為TN4002PC指定新生成的TTO配置檔，實現功能的調用。<br />   3. 在匯出完成後發送鍵盤指令關掉MSGBOX框。<br />         因為VBS中看似沒法能夠直接獲取TN4002PC的窗口，所以是添加處理--在程式處理過程中每間隔一段時間就去檢查生成的TXT檔案大小是否有變化，如果沒有變化則認定可能已匯出完成，卡在MSGBOX窗口，VBS程式就要激活MSGBOX窗口並發送鍵盤的空格。<br />   4. 在“計劃任務”中設置對VBS程序的調用。<br />         利用計劃任務精靈可以完成對VBS程序的調用，因為我這裏設計是要將配置的TTO文件名做為參數傳給VBS程序。而XP下試過幾次都無法能在計劃任務中直接將參數傳遞過去(2003卻可以)，所以就只有多做一只BAT(放置對VBS程式的傳參調用)放在計劃任務中。<br /><br /><strong>BAT批處理程序</strong>(藍色即為VBS程序，紅色為保存的TTO配置檔)</font>
		</p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<span style="COLOR: #000000">
						<font face="Georgia">
								<font size="2">start <font color="#0000ff">RunVBS.vbs</font> <font color="#ff0000">C:\FGPPOLR.tto</font></font>
						</font>
				</span>
		</div>
		<p>
				<strong>
						<font face="Georgia" size="2">VBS程序</font>
				</strong>
		</p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<font face="Georgia">
						<font size="2">
								<img id="Code_Closed_Image_153821" onclick="this.style.display='none'; Code_Closed_Text_153821.style.display='none'; Code_Open_Image_153821.style.display='inline'; Code_Open_Text_153821.style.display='inline';" height="16" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" />
								<img id="Code_Open_Image_153821" style="DISPLAY: none" onclick="this.style.display='none'; Code_Open_Text_153821.style.display='none'; Code_Closed_Image_153821.style.display='inline'; Code_Closed_Text_153821.style.display='inline';" height="16" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" />
								<span id="Code_Closed_Text_153821" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">VBS程序</span>
						</font>
				</font>
				<span id="Code_Open_Text_153821" style="DISPLAY: none">
						<br />
						<!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>-->
						<font face="Georgia">
								<font size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
										<span style="COLOR: #0000ff">Dim</span>
								</font>
						</font>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #000000"> ws,fso<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
										<span style="COLOR: #0000ff">Dim</span>
								</font>
						</font>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #000000"> ttoFile,tmpFile,sTmpfileName,sTxtfileName<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
										<span style="COLOR: #0000ff">Dim</span>
								</font>
						</font>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #000000"> line,sDate<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
										<span style="COLOR: #008000">'</span>
										<span style="COLOR: #008000">當前的日期/時間</span>
								</font>
						</font>
						<span style="COLOR: #008000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
								</font>
						</span>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #000000">sDate </span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">Year</span>
										<span style="COLOR: #000000">(</span>
										<span style="COLOR: #0000ff">Now</span>
										<span style="COLOR: #000000">()) </span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">Right</span>
										<span style="COLOR: #000000">(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">0</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #0000ff">Month</span>
										<span style="COLOR: #000000">(</span>
										<span style="COLOR: #0000ff">Now</span>
										<span style="COLOR: #000000">()),</span>
										<span style="COLOR: #000000">2</span>
										<span style="COLOR: #000000">) </span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">Right</span>
										<span style="COLOR: #000000">(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">0</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #0000ff">Day</span>
										<span style="COLOR: #000000">(</span>
										<span style="COLOR: #0000ff">Now</span>
										<span style="COLOR: #000000">()),</span>
										<span style="COLOR: #000000">2</span>
										<span style="COLOR: #000000">) </span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">Right</span>
										<span style="COLOR: #000000">(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">0</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">Hour</span>
										<span style="COLOR: #000000">(</span>
										<span style="COLOR: #0000ff">Now</span>
										<span style="COLOR: #000000">()),</span>
										<span style="COLOR: #000000">2</span>
										<span style="COLOR: #000000">) </span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">Right</span>
										<span style="COLOR: #000000">(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">0</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">Minute</span>
										<span style="COLOR: #000000">(</span>
										<span style="COLOR: #0000ff">Now</span>
										<span style="COLOR: #000000">()),</span>
										<span style="COLOR: #000000">2</span>
										<span style="COLOR: #000000">) </span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">Right</span>
										<span style="COLOR: #000000">(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">0</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">Second</span>
										<span style="COLOR: #000000">(</span>
										<span style="COLOR: #0000ff">Now</span>
										<span style="COLOR: #000000">()),</span>
										<span style="COLOR: #000000">2</span>
								</font>
						</font>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #000000">)<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
										<span style="COLOR: #0000ff">Set</span>
										<span style="COLOR: #000000"> ws </span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> WScript.CreateObject(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">WScript.Shell</span>
										<span style="COLOR: #000000">"</span>
								</font>
						</font>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #000000">)<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
										<span style="COLOR: #0000ff">Set</span>
										<span style="COLOR: #000000"> fso </span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">CreateObject</span>
										<span style="COLOR: #000000">(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">Scripting.FileSystemObject</span>
										<span style="COLOR: #000000">"</span>
								</font>
						</font>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #000000">)<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
										<span style="COLOR: #008000">'</span>
										<span style="COLOR: #008000">新生成TTO配置檔,放在系統TEMP路徑中</span>
								</font>
						</font>
						<span style="COLOR: #008000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
								</font>
						</span>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #000000">sTmpfileName </span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> fso.getspecialfolder(</span>
										<span style="COLOR: #000000">2</span>
										<span style="COLOR: #000000">) </span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">\</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #000000"> sDate </span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">.tto</span>
										<span style="COLOR: #000000">"</span>
								</font>
						</font>
						<span style="COLOR: #000000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
								</font>
						</span>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #0000ff">If</span>
										<span style="COLOR: #000000"> WScript.Arguments.Count</span>
										<span style="COLOR: #000000">&gt;</span>
										<span style="COLOR: #000000">0</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">Then</span>
								</font>
						</font>
						<span style="COLOR: #000000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    </font>
						</span>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #0000ff">Set</span>
										<span style="COLOR: #000000"> ttoFile </span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> fso.openTextFile(WScript.Arguments(</span>
										<span style="COLOR: #000000">0</span>
										<span style="COLOR: #000000">),</span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000">,</span>
										<span style="COLOR: #0000ff">False</span>
								</font>
						</font>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #000000">)<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    </span>
										<span style="COLOR: #0000ff">Set</span>
										<span style="COLOR: #000000"> tmpFile </span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> fso.openTextFile(sTmpfileName,</span>
										<span style="COLOR: #000000">2</span>
										<span style="COLOR: #000000">,</span>
										<span style="COLOR: #0000ff">True</span>
								</font>
						</font>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #000000">)<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    </span>
										<span style="COLOR: #0000ff">While</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">Not</span>
								</font>
						</font>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #000000"> ttoFile.AtEndOfStream<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        line </span>
										<span style="COLOR: #000000">=</span>
								</font>
						</font>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #000000"> ttoFile.ReadLine()<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span>
										<span style="COLOR: #008000">'</span>
										<span style="COLOR: #008000">查找到PC_FILENAME參數設定,並在文件名上加入日期/時間</span>
								</font>
						</font>
						<span style="COLOR: #008000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
								</font>
						</span>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #000000">        </span>
										<span style="COLOR: #0000ff">If</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">InStr</span>
										<span style="COLOR: #000000">(</span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000">,line,</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">PC_FILENAME=</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">)</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">Then</span>
								</font>
						</font>
						<span style="COLOR: #000000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />            </font>
						</span>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #0000ff">If</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">InstrRev</span>
										<span style="COLOR: #000000">(line,</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">.</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">)</span>
										<span style="COLOR: #000000">&gt;</span>
										<span style="COLOR: #000000">0</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">Then</span>
								</font>
						</font>
						<span style="COLOR: #000000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />                line </font>
						</span>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">Mid</span>
										<span style="COLOR: #000000">(line,</span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000">,</span>
										<span style="COLOR: #0000ff">InstrRev</span>
										<span style="COLOR: #000000">(line,</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">.</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">)</span>
										<span style="COLOR: #000000">-</span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000">) </span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">_</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #000000"> sDate </span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">Right</span>
										<span style="COLOR: #000000">(line,</span>
										<span style="COLOR: #0000ff">Len</span>
										<span style="COLOR: #000000">(line)</span>
										<span style="COLOR: #000000">-</span>
										<span style="COLOR: #0000ff">InstrRev</span>
										<span style="COLOR: #000000">(line,</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">.</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">)</span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000">1</span>
								</font>
						</font>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #000000">)<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">Else</span>
								</font>
						</font>
						<span style="COLOR: #000000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />                line </font>
						</span>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> line </span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">_</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">&amp;</span>
								</font>
						</font>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #000000"> sDate<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">End</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">If</span>
								</font>
						</font>
						<span style="COLOR: #000000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />            sTxtfileName </font>
						</span>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">Mid</span>
										<span style="COLOR: #000000">(line,</span>
										<span style="COLOR: #000000">13</span>
								</font>
						</font>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #000000">)<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span>
										<span style="COLOR: #0000ff">End</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">If</span>
								</font>
						</font>
						<span style="COLOR: #000000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        tmpFile.WriteLine(line)<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    </font>
						</span>
						<span style="COLOR: #0000ff">
								<font face="Georgia" size="2">Wend</font>
						</span>
						<span style="COLOR: #000000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    tmpFile.close<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    ttoFile.close<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    </font>
						</span>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #0000ff">If</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">True</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">Then</span>
								</font>
						</font>
						<span style="COLOR: #000000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    </font>
						</span>
						<span style="COLOR: #0000ff">
								<font face="Georgia" size="2">Dim</font>
						</span>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #000000"> oExec,lastSize,newSize,blnFlag1<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    blnFlag1 </span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">False</span>
								</font>
						</font>
						<span style="COLOR: #000000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    lastSize </font>
						</span>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">-</span>
										<span style="COLOR: #000000">2</span>
								</font>
						</font>
						<span style="COLOR: #000000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    </font>
						</span>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #008000">'</span>
										<span style="COLOR: #008000">調用TN4002PC來完成匯出操作</span>
								</font>
						</font>
						<span style="COLOR: #008000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
								</font>
						</span>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #000000">    </span>
										<span style="COLOR: #0000ff">Set</span>
										<span style="COLOR: #000000"> oExec </span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> ws.exec(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">C:\TN5250NF\TN4002PC.EXE /f=</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">&amp;</span>
								</font>
						</font>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #000000"> sTmpfileName)<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    </span>
										<span style="COLOR: #0000ff">Do</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">While</span>
										<span style="COLOR: #000000"> oExec.Status </span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">0</span>
								</font>
						</font>
						<span style="COLOR: #000000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        WScript.Sleep </font>
						</span>
						<span style="COLOR: #000000">
								<font face="Georgia" size="2">5000</font>
						</span>
						<span style="COLOR: #000000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </font>
						</span>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #0000ff">If</span>
										<span style="COLOR: #000000"> blnFlag1 </span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">False</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">Then</span>
								</font>
						</font>
						<span style="COLOR: #000000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />            </font>
						</span>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #0000ff">If</span>
										<span style="COLOR: #000000"> fso.FileExists(sTxtfileName) </span>
										<span style="COLOR: #0000ff">Then</span>
								</font>
						</font>
						<span style="COLOR: #000000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />                newSize </font>
						</span>
						<span style="COLOR: #000000">
								<font face="Georgia" size="2">=</font>
						</span>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #000000"> fso.GetFile(sTxtfileName).Size<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />                </span>
										<span style="COLOR: #0000ff">If</span>
										<span style="COLOR: #000000"> newSize </span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> lastSize </span>
										<span style="COLOR: #0000ff">Then</span>
								</font>
						</font>
						<span style="COLOR: #000000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />                    blnFlag1 </font>
						</span>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">True</span>
								</font>
						</font>
						<span style="COLOR: #000000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />                </font>
						</span>
						<span style="COLOR: #0000ff">
								<font face="Georgia" size="2">Else</font>
						</span>
						<span style="COLOR: #000000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />                    lastSize </font>
						</span>
						<span style="COLOR: #000000">
								<font face="Georgia" size="2">=</font>
						</span>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #000000"> newSize<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />                </span>
										<span style="COLOR: #0000ff">End</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">If</span>
								</font>
						</font>
						<span style="COLOR: #000000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />            </font>
						</span>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #0000ff">End</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">If</span>
								</font>
						</font>
						<span style="COLOR: #000000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </font>
						</span>
						<span style="COLOR: #0000ff">
								<font face="Georgia" size="2">Else</font>
						</span>
						<span style="COLOR: #000000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />            </font>
						</span>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #008000">'</span>
										<span style="COLOR: #008000">如果一段時間內匯出檔案大小無變化,則激活窗口並發送空格</span>
								</font>
						</font>
						<span style="COLOR: #008000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
								</font>
						</span>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #000000">            ws.AppActivate </span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">TN4002PC</span>
										<span style="COLOR: #000000">"</span>
								</font>
						</font>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #000000"> <br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />            ws.SendKeys </span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">"</span>
								</font>
						</font>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #000000">  <br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span>
										<span style="COLOR: #0000ff">End</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">If</span>
								</font>
						</font>
						<span style="COLOR: #000000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    </font>
						</span>
						<span style="COLOR: #0000ff">
								<font face="Georgia" size="2">Loop</font>
						</span>
						<span style="COLOR: #000000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    </font>
						</span>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #0000ff">End</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">If</span>
								</font>
						</font>
						<span style="COLOR: #000000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
								</font>
						</span>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #0000ff">End</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">If</span>
								</font>
						</font>
						<span style="COLOR: #000000">
								<br />
								<font face="Georgia" size="2">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
								</font>
						</span>
						<font face="Georgia">
								<font size="2">
										<span style="COLOR: #0000ff">Set</span>
										<span style="COLOR: #000000"> ws </span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">Nothing</span>
								</font>
						</font>
						<span style="COLOR: #000000">
								<font face="Georgia" size="2">  <br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />WScript.quit</font>
						</span>
				</span>
		</div>
		<p>
				<font face="Georgia" size="2">排程執行完後(每次都會有FDF--欄位定義和TXT--檔案內容兩個文件生成，多次RUN出文件名會不同):<br /><img title="執行完成" height="494" alt="o_RUNED.GIF" src="http://www.blogjava.net/images/blogjava_net/tw-ddm/10051/o_RUNED.GIF" width="713" border="0" /></font>
		</p>
		<p>
				<strong>
						<font face="Georgia" size="2">
								<br />下載</font>
				</strong>
				<br />      <font face="Georgia" size="2"><a href="/Files/tw-ddm/RUNBAT_VBS.zip">VBS文件</a></font></p>
<img src ="http://www.blogjava.net/tw-ddm/aggbug/254262.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tw-ddm/" target="_blank">大大毛</a> 2009-02-11 15:51 <a href="http://www.blogjava.net/tw-ddm/articles/254262.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>