` Printed Icetips Article

Icetips Article



Templates: Template to open file
1998-09-09 -- John Hickey
 
Newsgroups: topspeed.products.c4

Editors note:  Please note that some lines may wrap in the template code.

Here's one of those little Templates to make your lives easier :)

Save the code below as OPENCLS.TPL in your Template directory, and register
it.

This contains 2 Code templates you can add to the front and back of your
Source embed.  It will open all the files in your OTHER FILES listing and
then close all the files.  Your Source embeds might look like this:

Data Section
Processed Code
 -Open Files In Source Procedure
 -SOURCE
 -Clsoe Files In Source Procedure

Should work in both ABC and Legacy.... have fun!

=Snip Here=========================================

#TEMPLATE(OpenCloseFiles,'Open/Close Files In A Source
Procedure'),FAMILY('ABC'),FAMILY('CW20')
#!Copyright 1998, POSitive Software Company, All Rights Reserved
#!Written By John Hickey
#!Not For Resale! Distribute Freely!
#CODE(OpenFiles,'Open Files In Source Procedure')
#!
#FOR(%OtherFiles)
   #CASE (SUB(%CWTemplateVersion,1,2))
   #OF ('v2')
IF %OtherFiles::Used = 0
   CheckOpen(%OtherFiles,1)
END
%OtherFiles::Used += 1
   #OF ('v4')
Relate:%OtherFiles.Open
   #ENDCASE
#ENDFOR
#!---------------------------------------------------------
#CODE(CloseFiles,'Close Files In Source Procedure')
#!
#FOR(%OtherFiles)
   #CASE (SUB(%CWTemplateVersion,1,2))
   #OF ('v2')
%OtherFiles::Used -= 1
IF %OtherFiles::Used = 0 THEN CLOSE(%OtherFiles).
   #OF ('v4')
Relate:%OtherFiles.Close
   #ENDCASE
#ENDFOR

=Snip Here=========================================

>On Wed, 09 Sep 1998 16:27:46 -0500, Chris Moore 
>wrote:
>
>>Why does the SOURCE procedure not open the files for you? It allows you
>>to select 'Other' files but it doesn't open them for you. What is the
>>best method to open them in Source procedures?



Printed May 5, 2024, 5:32 am
This article has been viewed/printed 35117 times.
Google search has resulted in 17 hits on this article since January 25, 2004.