Note: This is a work in progress and will be formatting errors. Read more about the project on the home page.
read from file fileName [at [-] ¬
integer] {for posInteger |until char}
The read
command reads data from a file. (You must have already opened the file with the open file
command.) Read
places the data into the local variable it
. at
character integer
. If you use the form at -integer
, reading starts at integer
characters from the end of
Read
continues until it has read the specified number of characters or it reaches the named ASCII character (which can be specified as a constant: colon, comma, end
, eof
, formfeed
, quote
, return
, space
,
or tab
). read from file "Data" until Z -- read until first Z
read from file "Data" until tab
read from file "Data" until return -- read one line
read from file "Data" until end -- read until the end of the file
read from file "Data" for 100 -- read 100 bytes
read from file "Data" at 200 for 100 -- read 100 bytes ¬
starting at the 200th character in the file
read from file "Data" at -200 for 100 -- read 100 bytes ¬
starting at the 200th character from the end of the file
read from file "My Data"
-- This function asks for the name of a text file and reads it.
-- You might use it as follows:
-- put readFile() into myInfo
-- Note that variables can hold unlimited amounts of information
-- while fields can only hold 30k.
function readFile
answer file "Read what text file?" of type text
if (it is empty) or (it is "Cancel") then return empty
put it into theFileName
open file theFileName
repeat forever
read from file theFileName for 16384
if it is empty then exit repeat
put it after theData
end repeat
close file theFileName
return theData
end readFile
"my stack"
"HD20:Wally's Stacks:my stack"
"my file alias"
3
18 - 100
-(3 * sum(1,3,4,5)) + 39
In AppleScript, integer is a value class.
3
67 mod 13
the number of bg fields
the number of backgrounds
the number of cards div 2
See also: background, bkgnd, button, card, chunk,
field,
menu
, and menuItem
"a"
return
tab
numToChar(13)
Commands
Version 0.7b1 (March 24, 2022)