dtw@f.gp.cs.cmu.edu (Duane Williams) (08/30/87)
The following HyperCard script took 384 seconds (6.4 minutes) to read a text file with 256 lines (17,770 chars) from a Photon 20 hard disk on a Mac Plus. ---------------- on mouseUp put cursor into saveCursor set cursor to 4 --watch cursor put the seconds into startTime open file "MacTutor" read from file "MacTutor" until return put 0 into N repeat until it is empty add 1 to N put it into line N of card field "MacTutor" read from file "MacTutor" until return end repeat close file "MacTutor" put "File reading took " & (the seconds - startTime) & " seconds" set cursor to saveCursor end mouseUp ---------------- Duane Williams dtw@me.ri.cmu.edu
graifer@net1.UUCP (09/01/87)
I am having some trouble with file reading in Hypertext. I have a text file which several editors and the finder all agree contains >10K of text. But no matter how I read it, I get nothing! on mouseUp open file "Test Text" read from file "Test Text" until return put size of it into message close file "Test Text" end mouseUp this rule always gives a 0 result, even if I change the "until return" to "for 100". I've made sure the correct directory is in my home stack documents card, and if I take this out, I get a getfile dialog asking for the file. So it's isn't that it cannot find the file. This is under 3.2/5.3 Any ideas? Dan Graifer graifer@net1.UCSD.EDU Disclaimer: Nobody ever listens to me anyways; Why should they start now?
anson@elrond.CalComp.COM (Ed Anson) (09/02/87)
In article <3768@sdcsvax.UCSD.EDU> graifer@net1.UUCP (Dan Graifer) writes: >on mouseUp > open file "Test Text" > read from file "Test Text" until return > put size of it into message > close file "Test Text" >end mouseUp > >this rule always gives a 0 result, even if I change the "until return" to >"for 100". Size is a stack property. I ran the same script, and got different results. The first line of the file "Test Text" was interpreted as the name of a stack. The size of that stack was placed in the message box. In other words, HyperTalk dereferenced "it" before applying it as a parameter. Of course, it is possible to say put it into message and see the first line of your file. Now, has anybody figured out how to determine the length of a record? -- ===================================================================== Ed Anson, Calcomp Display Products Division, Hudson NH 03051 (603) 885-8712, anson@elrond.CalComp.COM