> Oh thanks but i don't know that script so if u have then tell me.

Type the following in the message window:

put interface(xtra "fileIO")

That will show you all of fileIO's commands.

Here is a basic "save text" script (the "bones" of this came from LIAN a
long, long time ago... Thanks, Bruce):
-------------------
--Parameters:
--stringToSave: The string to write into the external file
--saveFileName: The name for the file when it's saved
--saveFilePath: Optional. If you supply a path, the file will
--              be saved to that directory. Otherwise, the save
--              dialogue will be used to get a path from the user.

on saveText stringToSave, saveFileName, savefilePath
  
  resultflag = -1
  
  --instantiate an instance of the fileIO xtra
  filextra = new(xtra "FileIO")
  
  if not objectP(fileXtra) then
    alert "FileIO not installed."
    return resultFlag
  end if
  
  if the platform contains "Windows" then
    setFilterMask (filextra, "All Files, *.*")
  else
    setFilterMask (filextra, Empty)
  end if
  
  --If no save path is passed in, then open the dialogue box
  --and ask the user for a directory to save to
  if voidP(savefilePath) then
    savefilePath = displaySave(filextra, saveFileName, saveFileName &
".txt")
  end if
  
  --Create the file to write to
  createfile (filextra, saveFilePath)
  case (status(filextra)) of
    0:
      --All is well
      nothing
    -122:
      --The file exists, so open and delete it, then try to create it anew
      openfile (filextra, saveFilePath, 0)
      delete (filextra)
      createfile (filextra, saveFilePath)
      if status (filextra) <> 0 then
        put "Error:" && error (filextra, status(filextra))
        return resultFlag
      end if
      
    otherwise:
      --Another type of error. Put the error to the message window for
      --debugging
      put "Error:" && error (filextra, status(filextra))
      return resultFlag
  end case
  
  --Open up the file so that it can be written to
  openfile (filextra, saveFilePath, 0)
  
  if status (filextra) = 0 then
    --Write to the file
    writestring (filextra, stringToSave)
    --Set the file resources
    setFinderInfo (filextra, "TEXT ttxt")
    closeFile (filextra)
    return 1
  else
    put "Error:" && error (filextra, status(filextra))
    return resultFlag
  end if
  
end 
----------------------

I suggest that you study the above carefully, rather than simply using it
without understanding it.

-Kurt


[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to