From: "Thomas Swann, TPA Engineering, 813-532-2632"
I have another solution to the problem that I thought I'd present. It lets
you view the file without changing it by creating a temp file (in the
directory given by the "TEMP" environment variable) and inserting the file
you want to view. Thus, although you can edit the file its not the
original. My macro also deletes the the intially created file, so unless
you save any changes you do make to the temp file, no hard disk space will
be wasted by the temp. It appears this stupid mailer wants to wrap my work
(how dare it mess with perfection. :P) Oh well, it wont be that hard to
fix the wrapped lines (will it even be necessary with SAL?)
//----------------------------------------------------------------------------
-
// Function: main
// Programmer: Thomas Swann
// Created: 07/25/97
// Purpose: Prompt user for a file name to view in "read only"
mode. If
// the user enters a valid filename, then
insert that file into
// a temporary file.
//----------------------------------------------------------------------------
-
// Changed: never
//----------------------------------------------------------------------------
-
proc main()
integer msglevel
string fileName[255] = ""
string tempName[255] = ""
// Get the name of the file to view from the user
if( Ask("File to edit in read only mode: [" + CurrDir(), fileName,
GetFreeHistory("VIEWFILE:filename")) )
// Verify that the file exists before we try to do anything
with it
if( FileExists(fileName) )
// Make a new temporary file into which the source
file will be read
tempName = GetEnvStr( "TEMP" )
tempName = MakeTempName( tempName, ".tse" )
// Edit this newly created file (which is empty)
// All but the InsertFile() and UnMarkBlock() calls have
been snagged
// directly from the capture.s macro file [Author
unknown]
if( EditFile(tempName) )
msglevel = Set(MsgLevel, _WARNINGS_ONLY_)
KillFile()
InsertFile( fileName, _DONT_PROMPT_ )
UnMarkBlock()
Set(MsgLevel, msglevel)
FileChanged( FALSE )
endif
else
// Warn user that an invalid filename was specified
message( "The specified file: " + fileName + " does
not exist." )
endif
else
// Display confirmation message of view cancellation
message( "No file to edit" )
endif
end
---
---------------
* Origin: apana>>>>>fidonet [sawasdi.apana.org.au] (3:800/846.13)
|