Xref: news.weeg.uiowa.edu comp.sys.apple2:64565 comp.sys.apple2.programmer:1274 Newsgroups: comp.sys.apple2,comp.sys.apple2.programmer Path: news.weeg.uiowa.edu!news.uiowa.edu!uunet!decwrl!decwrl!waikato!comp.vuw.ac.nz!actrix.gen.nz!dempson From: dempson@swell.actrix.gen.nz (David Empson) Subject: Re: Help w/ Hypercard read command Organization: Actrix Information Exchange Date: Mon, 25 Oct 1993 08:27:36 GMT Message-ID: References: Sender: dempson@actrix.gen.nz (David Empson) Lines: 46 In article msjohnso@silver.ucs.indiana.edu (micah shane johnson) writes: > When "read"ing files that have a CR-LF at the end of each line, > is there any way to make HCGS ignore one of them, so I can get > rid of the double-spaced effect. If you read a file which contains line feeds into HyperCard, it doesn't do anything special with the line feeds - they appear as inverse question marks (undefined character in the font). The following script demonstrates how to get rid of the line feeds. Note that this will be rather slow for large files, and the maximum file size that can be loaded is 32000 characters. I used these scripts in a button on a card which also had a text field called 'theText'. on mouseUp answer file "Select file to load:" of type text if it is not empty then -- read the selected file into a card field and strip line feeds put it into filename open file filename read from file filename until eof close file filename put stripLF(it) into cd field theText end if end mouseUp function stripLF theText repeat with i = 1 to number of lines of theText -- spin the beachball cursor for each line of text set cursor to busy -- if this line starts with a line feed, then delete it if first character of line i of theText is NumToChar(10) then delete first character of line i of theText end repeat set cursor to hand return theText end stripLF -- David Empson dempson@swell.actrix.gen.nz Snail mail: P.O. Box 27-103, Wellington, New Zealand