Problem with open file command

Ken Ray kray at
Sun Jan 16 00:34:02 EST 2005

On 1/15/05 11:28 PM, "Stgoldberg at" <Stgoldberg at> wrote:

> I have been trying to get the "open file" command to work on my G5 mac, e.g.
> trying to open a ".txt" file in the same folder as the application, but
> nothing happens.   Can anyone suggest what I might be doing wrong, and also
> what 
> sort of "files" one should expect Revolution to be able to open with this
> command?   Thanks.

Well, the "open file" command just opens a file so that you can take some
action on it (read from it, write to it, etc.). If your intent is to read
all the data from a file and put it into a variable, there are two ways -
the long way:

  open file <pathToFile>
  read from file <pathToFile> until eof
  close file <pathToFile>
  put it into MyVar

and the short way:

  put url("file:"<pathToFile>) into MyVar

The <pathToFile> is substituted with either a full path or a relative path
from where the 'defaultFolder' is pointing (which by default for standalones
is the folder where the standalone resides). So let's say I had a file
called "Prefs.txt" that was in the same folder as my standalone. I could to

  put url("file:Prefs.txt") into MyVar

If it was in a folder called "Support", I could call it like this:

  put url("file:Support/Prefs.txt") into MyVar

You get the idea...

Ken Ray
Sons of Thunder Software
Web site:
Email: kray at

More information about the Use-livecode mailing list